-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconsole
executable file
·53 lines (46 loc) · 1.87 KB
/
console
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
48
49
50
51
52
53
#!/usr/bin/php
<?php
/**
* This is the main file of Spitfire, it is in charge of loading
* system settings (for custom operation) and also of summoning
* spitfire and loading the adequate controller for every single
* request. It also makes sure that error logging is sent to
* terminal / log file instead of to the user.
*
* @package Spitfire
* @author César de la Cal <[email protected]>
* @copyright 2018 Magic3W - All rights reserved
*/
use magic3w\phpauth\kernel\ConsoleKernel as AppConsoleKernel;
use Monolog\Handler\StreamHandler;
use Psr\Log\LoggerInterface;
use spitfire\contracts\core\kernel\ConsoleKernelInterface;
use spitfire\contracts\core\kernel\KernelInterface;
use spitfire\contracts\core\LocationsInterface;
use spitfire\core\kernel\ConsoleKernel;
use spitfire\core\kernel\KernelFactory;
use spitfire\core\kernel\WebKernel;
use spitfire\core\Locations;
use spitfire\provider\Container;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Output\ConsoleOutput;
/* Include Spitfire core.
*/
define('BASEDIR', __DIR__);
include __DIR__ . '/vendor/autoload.php';
include __DIR__ . '/bin/settings/environments.php';
$provider = new Container();
$provider->set(Locations::class, new Locations(__DIR__));
$provider->set(LocationsInterface::class, new Locations(__DIR__));
$provider->set(ConsoleKernel::class, $kernel = new AppConsoleKernel(new Application()));
$provider->set(ConsoleKernelInterface::class, $kernel);
$provider->set(KernelInterface::class, $kernel);
$provider->set(WebKernel::class, $provider->get(WebKernel::class));
$provider->set(LoggerInterface::class, new Monolog\Logger('log', [new StreamHandler(STDOUT)]));
/**
*
* @var ConsoleKernel
*/
$kernel = $provider->get(KernelFactory::class)->boot($provider->get(ConsoleKernel::class));
exit($kernel->handle(new ArgvInput, new ConsoleOutput));