-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.php
41 lines (32 loc) · 1.14 KB
/
bootstrap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/**
* Shared bootstrap file
*/
// Define path constants
define('CRUDLE_BASE_PATH', __DIR__);
define('CRUDLE_VENDOR_PATH', CRUDLE_BASE_PATH . '/vendor');
// Load Composer's autoloader
require_once CRUDLE_VENDOR_PATH . '/autoload.php';
// Load dotenv?
if (class_exists(Dotenv\Dotenv::class)) {
// By default, this will allow .env file values to override environment variables
// with matching names. Use `createUnsafeImmutable` to disable this.
Dotenv\Dotenv::createUnsafeMutable(CRUDLE_BASE_PATH)->safeLoad();
}
// Determine if Crudle is running in Dev Mode
// -----------------------------------------------------------------------------
use crudle\app\helpers\App;
$devMode = (bool) App::env('CRUDLE_APP_DEBUG') ?? false;
if ($devMode) {
ini_set('display_errors', '1');
defined('YII_DEBUG') || define('YII_DEBUG', true);
defined('YII_ENV') || define('YII_ENV', 'dev');
} else {
ini_set('display_errors', '0');
defined('YII_DEBUG') || define('YII_DEBUG', false);
defined('YII_ENV') || define('YII_ENV', 'prod');
}
// Ensure you're running PHP 7.4+
if (PHP_VERSION_ID < 70400) {
exit('Crudle requires PHP 7.4');
}