1
0
mirror of https://github.com/flextype/flextype.git synced 2025-01-17 12:48:31 +01:00
php-flextype/index.php

68 lines
1.8 KiB
PHP
Raw Normal View History

2018-03-23 00:34:16 +03:00
<?php
2018-03-14 19:57:53 +03:00
declare(strict_types=1);
2018-03-09 13:11:52 +03:00
/**
* Flextype (https://awilum.github.io/flextype)
2019-08-11 11:55:51 +03:00
* Founded by Sergey Romanenko and maintained by Flextype Community.
2018-03-09 13:11:52 +03:00
*/
2018-03-23 00:34:16 +03:00
namespace Flextype;
use function define;
use function getcwd;
use function is_file;
use function sprintf;
use function str_replace;
use function version_compare;
use const DIRECTORY_SEPARATOR;
use const PHP_VERSION;
/**
* Define the application minimum supported PHP version.
*/
2020-12-27 18:25:37 +03:00
define('FLEXTYPE_MINIMUM_PHP', '7.4.0');
/**
* Define the PATH to the root directory (without trailing slash).
*/
2018-05-15 14:22:59 +03:00
define('ROOT_DIR', str_replace(DIRECTORY_SEPARATOR, '/', getcwd()));
/**
* Define the PATH (without trailing slash).
*/
define('PATH', [
2020-12-27 18:25:37 +03:00
'project' => ROOT_DIR . '/project',
'tmp' => ROOT_DIR . '/var/tmp',
]);
2018-05-15 14:22:59 +03:00
/**
* Check PHP Version
*/
2018-03-21 00:28:34 +03:00
version_compare($ver = PHP_VERSION, $req = FLEXTYPE_MINIMUM_PHP, '<') and exit(sprintf('You are running PHP %s, but Flextype needs at least <strong>PHP %s</strong> to run.', $ver, $req));
/**
* Ensure vendor libraries exist
*/
! is_file($flextypeAutoload = __DIR__ . '/vendor/autoload.php') and exit('Please run: <i>composer install</i> for flextype');
2018-03-09 13:11:52 +03:00
/**
* Register The Auto Loader
*
* Composer provides a convenient, automatically generated class loader for
* our application. We just need to utilize it! We'll simply require it
* into the script here so that we don't have to worry about manual
* loading any of our classes later on. It feels nice to relax.
* Register The Auto Loader
*/
$flextypeLoader = require_once $flextypeAutoload;
2018-03-09 13:11:52 +03:00
/**
* Bootstraps the Flextype
*
* This bootstraps the Flextype and gets it ready for use, then it
* will load up this application so that we can run it and send
* the responses back to the browser and delight our users.
*/
require_once __DIR__ . '/src/flextype/flextype.php';