gluephp/glue-database

Use mrjgreen/database in Glue

0.1.0 2016-05-06 19:37 UTC

This package is not auto-updated.

Last update: 2024-04-22 04:57:48 UTC


README

Use mrjgreen/database with gluephp/glue

Installation

Use Composer:

$ composer require gluephp/glue-database

Configuration

$app = new Glue\App;

$app->config->override([
    'database' => [
        'driver'    => 'mysql',
        'host'      => 'localhost',
        'username'  => 'root',
        'password'  => 'password',
        'charset'   => 'utf8',
        'collation' => 'utf8_unicode_ci',
    ]
]);

More configuration options can be found at https://github.com/mrjgreen/database

Register

$app->register(
    new Glue\Database\ServiceProvider()
);

Get the Database Connection instance

Once the service provider is registered, you can fetch the Whoops instance with:

$db = $app->make('Database\Connection');

or use the alias:

$db = $app->db;