DB.PHP - PHP ORM

Connect simply

Simple way to start is to specify server, database, username and password to database constructor.

$database = new \db\database(string $hostname, string $database, string $username, string $password);
$database = new \db\database('mysql:host=127.0.0.1', 'my_db', 'root', '1234');

hostname Is first parameter confusing? It is actually a data source name. db.php uses PDO as default link provider so first parameter is actually PDO data source name string.

database Second parameter is database name and used by db.php to locate your tables on this connection.

username This is what you think.

password Same applies here.

This was the simpliest connection ever db.php can handle but remember you can have multiple connections to multiple servers and multiple databases same time.