Cli
This commit is contained in:
48
setup/cli.app.php
Normal file
48
setup/cli.app.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
use Psr\Container\ContainerInterface;
|
||||
use DI\ContainerBuilder;
|
||||
use Symfony\Component\Console\Application;
|
||||
|
||||
require_once 'composer.php';
|
||||
|
||||
$builder = new ContainerBuilder();
|
||||
$files = [
|
||||
'config',
|
||||
'setups'
|
||||
];
|
||||
foreach ($files as $f) {
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||
__DIR__,
|
||||
'cli',
|
||||
"{$f}.php"
|
||||
]);
|
||||
if (!file_exists($filename)) {
|
||||
continue;
|
||||
}
|
||||
$builder->addDefinitions($filename);
|
||||
}
|
||||
$app = new class() extends Application
|
||||
{
|
||||
protected ContainerInterface $container;
|
||||
public function getContainer(): ContainerInterface
|
||||
{
|
||||
return $this->container;
|
||||
}
|
||||
public function setContainer(ContainerInterface $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
return $this;
|
||||
}
|
||||
};
|
||||
$app->setContainer($builder->build());
|
||||
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||
__DIR__,
|
||||
'cli',
|
||||
'middlewares.php'
|
||||
]);
|
||||
if (file_exists($filename)) {
|
||||
include_once $filename;
|
||||
}
|
||||
|
||||
return $app;
|
Reference in New Issue
Block a user