PHP code example of gluephp / glue-database

1. Go to this page and download the library: Download gluephp/glue-database library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gluephp / glue-database example snippets


$app = new Glue\App;

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

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

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

$db = $app->db;