PHP Classes

File: app/app.php

Recommend this page to a friend!
  Classes of Pierre-Henry Soria   MyDreamLife.eu   app/app.php   Download  
File: app/app.php
Role: Example script
Content type: text/plain
Description: Example script
Class: MyDreamLife.eu
Plan a life change to a different country
Author: By
Last change:
Date: 1 year ago
Size: 948 bytes
 

Contents

Class file image Download
<?php
/**
 * @author Pierre-Henry Soria <hi@ph7.me>
 * @copyright (c) 2017-2018, Pierre-Henry Soria. All Rights Reserved.
 * @license GNU General Public License; <https://www.gnu.org/licenses/gpl-3.0.en.html>
 */

use Core\Database;
use
Core\Main;

define('APP_PATH', __DIR__ . DIRECTORY_SEPARATOR);

require
'config/site.php';
require
'helpers.php';
require
'vendor/autoload.php';

if (
DEBUG_MODE) {
   
error_reporting(E_ALL);
   
ini_set('display_errors', 'On');
} else {
   
error_reporting(0);
   
ini_set('display_errors', 'Off');
}


spl_autoload_register(function (string $className) {
   
$className = str_replace('\\', '/', $className);

   
$filename = APP_PATH . $className . '.php';
    if (
is_readable($filename)) {
        require
$filename;
    }
});


try {
   
Main::store();
   
Database::connect(Main::get('db'));

    require
'routes.php';
} catch (
Exception $except) {
    echo
$except->getMessage();
}