The Power ORM


To connect to an SQLite testing database, without having to make one yourself, use:

    require 'rb.php';

On most systems, this just works.
This code creates a test database in your /tmp folder.
Of course, this is meant for testing purposes only (and to fool around), to connect to a real database, use one of the following snippets:


MariaDB (formerly known as MySQL) is the most popular database among web developers. Use MariaDB or MySQL for light web development. To connect to a MySQL database or a MariaDB database:

'user''password' ); //for both mysql or mariaDB

Did you manage to establish a connection to the database? Proceed to learn the basics of RedBeanPHP!


Postgres evolved from the classic Ingres database and is by far the most advanced database you can get. Use Postgres for serious application development. Postgres is rock solid and has lots of power features like window functions, support for hierarchical queries and materialized views. To connect to a PostgreSQL database:

'user''password' );


SQLite is file based database, ideal for embedded applications, prototyping, small (and smart) applications, small websites (not too much traffic) and data analysis. To connect to an SQLite database:

    R::setup'sqlite:/tmp/dbfile.db' );


CUBRID is an exciting database platform focusing on web development. It's an ideal replacement for rusty MySQL servers. While CUBRID seems to be almost completely compatible with MySQL it also offers a great deal of advanced features, like hierarchical queries and click counters. However, CUBRID also offers a very complete, easy-to-use GUI based toolchain. To use the CUBRID database with RedBeanPHP4, first install the plugin pack. To connect to a CUBRID database:



To disconnect use:


This will close the database connection.

back to main menu

Sponsored by:
CSSBurner Barcraft United   PapelDigital

RedBeanPHP Easy ORM for PHP © 2018 () and the RedBeanPHP community () - Licensed New BSD/GPLv2 - RedBeanPHP Archives