PHP Classes

File: public/index.php

Recommend this page to a friend!
  Classes of Scott Arciszewski   Chronicle   public/index.php   Download  
File: public/index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Chronicle
Append arbitrary data to a storage container
Author: By
Last change: We don't use sessions for anything, so don't session_start() at all.
Last-ditch autoload.
Fix settings loading
Date: 1 year ago
Size: 890 bytes
 

Contents

Class file image Download
<?php
use ParagonIE\Chronicle\Chronicle;
use
Slim\App;

if (
PHP_SAPI == 'cli-server') {
   
// To help the built-in PHP dev server, check if the request was actually for
    // something which should probably be served as a static file
   
$url = parse_url($_SERVER['REQUEST_URI']);
   
$file = __DIR__ . $url['path'];
    if (
is_file($file)) {
        return
false;
    }
}

require
dirname(__DIR__) . '/cli-autoload.php';

// Instantiate the app
$settings = require CHRONICLE_APP_ROOT . '/src/settings.php';
Chronicle::storeSettings($settings['settings'] ?? []);
$app = new App($settings);

// Set up dependencies
require CHRONICLE_APP_ROOT . '/src/dependencies.php';
require
CHRONICLE_APP_ROOT . '/src/database.php';

// Register middleware
require CHRONICLE_APP_ROOT . '/src/middleware.php';

// Register routes
require CHRONICLE_APP_ROOT . '/src/routes.php';

// Run app
$app->run();