Welcome to db.php: A full funcitional but simple PHP ORM

db.php is open source simple php orm. In difference with other php orm alternatives db.php delivers simpliest intuitive api while stays fully functional and performance optimazed. Also db.php offers ability to automatically generate and synchronize tables and databases based on class model.

db.php is called db.php because it represents just a single db.php file. The only thing you need to do for installing db.php is to include db.php. Or just require it with composer:

composer require hazardland/db:dev-master

Shortly about project

db.php is delivered under MIT license. Basically our users just clone db.php source directly from our github page or they just grab db.php file from it and in rare cases they even star our github repository which generally makes us proud. If you have questions feel free to create issue under our repo here or send us an email at contact@dbphp.net afterwards we wish you that db.php became everyday tool for simplifying your life and for gaining more free time in your personal life which sometimes matters.

As far as this web page was created between 3 and 5 AM we apologize for syntax errors.

Below we will give you a basic idea about db.php usage

This is how class handler is registered in db.php:

$database->add ('\user\group');

This is how handlers for all classes under namespace are registered in db.php:

$database->scan ('\user');

This is how databases, tables and fields are created or updated for registered classes:

$database->update ();

This is how class object is saved in db.php:

$database->save (new \user\group());

This is how class object is saved in db.php in another way:

$database->user->group->save (new \user\group());

This is how class object is loaded by id:

$database->user->group->load (1);

This is how class object is deleted by id:

$database->user->group->delete (1);

This is how class object is updated:

$database->save ($group);


$database->user->group->save ($group);

Of course this is not all as db.php offers control on every tiny aspect. Before reading manual you can first checkout our small showcase.

Or if you are new in orm field you should start reading article about What is ORM?