PHP Classes

File: bin/scheduled-tasks.php

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

Contents

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

use
ParagonIE\EasyDB\{
   
EasyDB,
   
Factory
};
use
ParagonIE\Chronicle\Chronicle;

$root = \dirname(__DIR__);
require_once
$root . '/cli-autoload.php';

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

$settings = \json_decode(
    (string) \
file_get_contents($root . '/local/settings.json'),
   
true
);

/** @var EasyDB $db */
$db = Factory::create(
   
$settings['database']['dsn'],
   
$settings['database']['username'] ?? '',
   
$settings['database']['password'] ?? '',
   
$settings['database']['options'] ?? []
);
Chronicle::storeSettings($settings);
Chronicle::setDatabase($db);

// Run the scheduler:
(new ParagonIE\Chronicle\Scheduled($settings))->run();

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