Install / configure

Install using composer

composer require stilmark/database

Configure

Database connection credentials should be set using in the .env file.

.env
DB_HOST=127.0.0.1
DB_DATABASE=test
DB_USERNAME=test
DB_PASSWORD=test

Basic usage

require('/vendor/autoload.php');

use Symfony\Component\Dotenv\Dotenv;
use Stilmark\Database\Dba;

$dotenv = new Dotenv();
$dotenv->load(ROOT.'/.env');

# Build sql queries or ...
$users = Dba::instance()->table('users')->list();

# Extend your models on Dbi()
$users = User::list();

Last updated