-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp
executable file
·28 lines (21 loc) · 906 Bytes
/
app
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
#!/usr/bin/env php
<?php
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\YamlFileLoader;
// Load services and commands from services.yaml
$container = new ContainerBuilder();
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/config'));
$loader->load('services.yaml');
// compile the DI container
$container->compile();
// create new console application
$application = new Application();
// add all services from the container that are tagged "console.command" as commands in the app
$consoleCommands = $container->findTaggedServiceIds('console.command');
foreach ($consoleCommands as $consoleCommand => $tags) {
$application->add($container->get($consoleCommand));
}
$application->run();