Example Online Postgre – Rune + RedBean CLI Application

This project is an example CLI application demonstrating how to use Neon PostgreSQL (a fully managed cloud PostgreSQL platform) in combination with Rune and RedBeanPHP. The application allows you to perform CRUD operations on a user table directly from…


This content originally appeared on DEV Community and was authored by Anwar Achilles

This project is an example CLI application demonstrating how to use Neon PostgreSQL (a fully managed cloud PostgreSQL platform) in combination with Rune and RedBeanPHP. The application allows you to perform CRUD operations on a user table directly from the CLI, making it perfect for developers who want a lightweight, fast, and flexible way to interact with a database without building a full web interface.

The project leverages:

  • Neon PostgreSQL – cloud-hosted PostgreSQL database
  • Rune – for CLI management and scripting
  • RedBeanPHP – lightweight ORM for PHP

Features

  • Create, read, update, and delete users using CLI commands.
  • Easily create database tables via scripts.
  • Works with Neon PostgreSQL in the cloud.
  • Clean, simple, and easy-to-extend structure.

Installation & Setup

Follow these steps to get started:

  • 1. Clone the repository
git clone https://github.com/devneet-id/rune-neon-example.git
cd rune-neon-example
  • 2. Load vendor packages
composer install
  • 3. Configure database connection Edit the main setup file where RedBean connects to Neon PostgreSQL. Replace placeholders with your Neon credentials:
$NEON_HOST = '';
$NEON_DB   = '';
$NEON_USER = '';
$NEON_PASS = '';

R::setup(
    "pgsql:host=$NEON_HOST;dbname=$NEON_DB;sslmode=require",
    $NEON_USER,
    $NEON_PASS
);

Using placeholders keeps your credentials safe for sharing or pushing to a repository.

Running the Application

To start the CLI application:

php cast

This will show available commands and let you run scripts, manage users, or view results.

 #  R E G I S T E R E D.
 ♦ php cast script
    #≈ runs a script, e.g., creating database t
    ables.
 ♦ php cast result
    #≈ lists all user emails in the database.
 ♦ php cast create
    #≈ create a new user, --email=(string)
 ♦ php cast update
    #≈ update an existing user, --id=(int) --em
    ail=(string)
 ♦ php cast delete
    #≈ delete an existing user, --id=(int)

Step by Step

  • 1. Create the user table
php cast script

This runs the script to create a user table if it does not exist.

  • 2. Add a new user
php cast create --email=demo@mail.com

Adds a new user to the database.

  • 3. View all users
php cast result

Lists all emails currently stored.

  • 4. Update a user’s email
php cast update --id=1 --email=updated@mail.com

Updates the email for the user with id=1.

  • 5. Delete a user
php cast delete --id=1

Removes the user from the database.

References

Summary

This project is an example showing how to integrate and use Neon PostgreSQL in PHP, with database management organized neatly using Rune. It demonstrates how to perform CRUD operations via CLI commands with RedBean, making it easy to understand the workflow and structure when working with a cloud PostgreSQL database.


This content originally appeared on DEV Community and was authored by Anwar Achilles


Print Share Comment Cite Upload Translate Updates
APA

Anwar Achilles | Sciencx (2025-10-04T14:59:16+00:00) Example Online Postgre – Rune + RedBean CLI Application. Retrieved from https://www.scien.cx/2025/10/04/example-online-postgre-rune-redbean-cli-application/

MLA
" » Example Online Postgre – Rune + RedBean CLI Application." Anwar Achilles | Sciencx - Saturday October 4, 2025, https://www.scien.cx/2025/10/04/example-online-postgre-rune-redbean-cli-application/
HARVARD
Anwar Achilles | Sciencx Saturday October 4, 2025 » Example Online Postgre – Rune + RedBean CLI Application., viewed ,<https://www.scien.cx/2025/10/04/example-online-postgre-rune-redbean-cli-application/>
VANCOUVER
Anwar Achilles | Sciencx - » Example Online Postgre – Rune + RedBean CLI Application. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/10/04/example-online-postgre-rune-redbean-cli-application/
CHICAGO
" » Example Online Postgre – Rune + RedBean CLI Application." Anwar Achilles | Sciencx - Accessed . https://www.scien.cx/2025/10/04/example-online-postgre-rune-redbean-cli-application/
IEEE
" » Example Online Postgre – Rune + RedBean CLI Application." Anwar Achilles | Sciencx [Online]. Available: https://www.scien.cx/2025/10/04/example-online-postgre-rune-redbean-cli-application/. [Accessed: ]
rf:citation
» Example Online Postgre – Rune + RedBean CLI Application | Anwar Achilles | Sciencx | https://www.scien.cx/2025/10/04/example-online-postgre-rune-redbean-cli-application/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.