-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.php
34 lines (26 loc) · 949 Bytes
/
app.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
<?php
declare(strict_types=1);
require __DIR__.'/vendor/autoload.php';
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Console\Application;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use Symfony\Component\Dotenv\Dotenv;
class App extends Application
{
public function __construct(iterable $commands, string $name, string $version)
{
$commands = $commands instanceof Traversable ? iterator_to_array($commands) : $commands;
foreach ($commands as $command) {
$this->add($command);
}
parent::__construct($name, $version);
}
}
$dotenv = new Dotenv();
$dotenv->load(__DIR__.'/.env');
$container = new ContainerBuilder();
$loader = new PhpFileLoader($container, new FileLocator(__DIR__ . '/config'));
$loader->load('services.php');
$container->compile(true);
$container->get(App::class)->run();