我坚持/psr11-symfony-console

在应用程序中使PSR容器对控制台可用

v1.2 2020-07-11 21:07 UTC

This package is auto-updated.

Last update: 2024-09-12 06:32:21 UTC


README

使PSR容器对命令可用。

use IamPersistent\Console\Application;

$application = new Application();
$application->setContainer($container);
$application->add(new MyCommand());
$application->run();

在命令中

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $container = $this->getApplication()->getContainer();
    }