PHP Classes

File: src/database.php

Recommend this page to a friend!
  Classes of Scott Arciszewski  >  Chronicle  >  src/database.php  >  Download  
File: src/database.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Chronicle
Append arbitrary data to a storage container
Author: By
Last change:
Date: 3 years ago
Size: 550 bytes
 

Contents

Class file image Download
<?php
declare(strict_types=1);

if (!\
is_readable(CHRONICLE_APP_ROOT . '/local/settings.json')) {
    echo
'Settings are not loaded.', PHP_EOL;
    exit(
1);
}

$settings = \json_decode(
    (string) \
file_get_contents(CHRONICLE_APP_ROOT . '/local/settings.json'),
   
true
);
$db = \ParagonIE\EasyDB\Factory::create(
   
$settings['database']['dsn'],
   
$settings['database']['username'] ?? '',
   
$settings['database']['password'] ?? '',
   
$settings['database']['options'] ?? []
);

\
ParagonIE\Chronicle\Chronicle::setDatabase($db);
return
$db;

For more information send a message to info at phpclasses dot org.