forked from openemr/openemr
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.php
More file actions
47 lines (38 loc) · 1.31 KB
/
bootstrap.php
File metadata and controls
47 lines (38 loc) · 1.31 KB
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
42
43
44
45
46
47
<?php
/**
* This will eventually be core application setup for all paths: web, cli, etc.
*
* It is only to be used for a small number of critical operations:
* - Autoloader setup
* - Environment reading and normalization
* - Standardizing some runtime configuration
* - Setting up error handling
* - Preparing DI tooling
*
* This MUST NOT do anything like the following:
* - Connect to the database
* - Interact with sessions
* - Touch any data derived from HTTP requests
* - Do anything with or for the "globals" config
*
* For now, it's only used in an experimental CLI tool.
*/
declare(strict_types=1);
use Dotenv\Dotenv;
use Firehed\Container\AutoDetect;
chdir(__DIR__);
date_default_timezone_set('UTC');
ini_set('display_errors', '0');
ini_set('display_startup_errors', '0');
// Docker wants logs written to stdout. This may need to vary by SAPI.
ini_set('error_log', '/dev/stdout');
ini_set('log_errors', '1');
error_reporting(E_ALL);
require_once 'vendor/autoload.php';
// class_exists check is because dotenv should be a dev dependency and not
// installed in prod deployments, though as of writing that's not the case.
if (class_exists(Dotenv::class) && file_exists('.env')) {
Dotenv::createImmutable('.')->load();
}
// Set up and return the PSR-11 DI container
return AutoDetect::instance('config');