File size: 951 Bytes
cf14c12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<?php

declare(strict_types=1);

use Easy\Container\Container;
use Psr\Container\ContainerInterface;
use Shared\Infrastructure\BootstrapperInterface;
use Shared\Infrastructure\ServiceProviderInterface;

/**
 * Bootstraps the application and the container.
 * Returns the container instance.
 * 
 * @return ContainerInterface
 */

// Make everything relative to the application root directory.
chdir(dirname(__DIR__));

// Configure class autoloading
require __DIR__ . '/autoload.php';

/** @var Container $container */
$container = require 'container.php';

/** @var (ServiceProviderInterface|string)[] $providers */
$providers = $container->get('providers');

/** @var (BootstrapperInterface|string)[] $bootstrappers */
$bootstrappers = $container->get('bootstrappers');

$app = new Application($container, (bool) env('DEBUG', true));
$app->addServiceProvider(...$providers)
    ->addBootstrapper(...$bootstrappers)
    ->boot();

return $container;