PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Pierre-Henry Soria   Minimalist PHP Sales Site   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Minimalist PHP Sales Site
Implement a sales site from configuration files
Author: By
Last change:
Date: 1 year ago
Size: 665 bytes
 

Contents

Class file image Download
<?php
/**
 * (c) Pierre-Henry Soria <hi@ph7.me>
 * MIT License - https://opensource.org/licenses/MIT
 */

require __DIR__ . '/vendor/autoload.php';

use
Dotenv\Dotenv;
use
Whoops\Handler\PrettyPageHandler;
use
Whoops\Run as WhoopsRun;

$whoops = new WhoopsRun;
$whoops->pushHandler(new PrettyPageHandler);
$whoops->register();

$requiredEnvFields = [
   
'SITE_URL',
   
'SITE_NAME',
   
'APP_EMAIL',
];

$env = Dotenv::createImmutable(__DIR__);
$env->load();
$env->required($requiredEnvFields)->notEmpty();

define('SITE_URL', $_ENV['SITE_URL']);
define('SITE_NAME', $_ENV['SITE_NAME']);
define('APP_EMAIL', $_ENV['APP_EMAIL']);

require
__DIR__ . '/app/app.php';