src/Viserio/Component/WebServer/Provider/ConsoleCommandsServiceProvider.php
public static function extendConsole(ContainerInterface $container, ?Application $console = null): ?Application
    {
        if ($console !== null) {
            $resolvedOptions = self::resolveOptions($container->get('config'));

            if (\class_exists(ConsoleFormatter::class) && \interface_exists(FormatterInterface::class)) {
                $console->add(new ServerLogCommand());
            }

            $documentRoot = null;
            $env          = null;

            if ($container->has(ConsoleKernelContract::class)) {
                $kernel = $container->get(ConsoleKernelContract::class);

                $documentRoot = $kernel->getRootDir() . '/' . \ltrim($resolvedOptions['webserver']['web_folder'], \DIRECTORY_SEPARATOR);
                $env          = $kernel->getEnvironment();
            }

            if (\class_exists(VarDumper::class)) {
                $console->add(new ServerDumpCommand($container->get(DumpServer::class)));
            }

            $console->addCommands([
                new ServerServeCommand($documentRoot, $env),
                new ServerStartCommand($documentRoot, $env),
                new ServerStatusCommand(),
                new ServerStopCommand(),
            ]);
        }

        return $console;
    }
public static function extendConsole(ContainerInterface $container, ?Application $console = null): ?Application
    {
        if ($console !== null) {
            $resolvedOptions = self::resolveOptions($container->get('config'));

            if (\class_exists(ConsoleFormatter::class) && \interface_exists(FormatterInterface::class)) {
                $console->add(new ServerLogCommand());
            }

            $documentRoot = null;
            $env          = null;

            if ($container->has(ConsoleKernelContract::class)) {
                $kernel = $container->get(ConsoleKernelContract::class);

                $documentRoot = $kernel->getRootDir() . '/' . \ltrim($resolvedOptions['webserver']['web_folder'], \DIRECTORY_SEPARATOR);
                $env          = $kernel->getEnvironment();
            }

            if (\class_exists(VarDumper::class)) {
                $console->add(new ServerDumpCommand($container->get(DumpServer::class)));
            }

            $console->addCommands([
                new ServerServeCommand($documentRoot, $env),
                new ServerStartCommand($documentRoot, $env),
                new ServerStatusCommand(),
                new ServerStopCommand(),
            ]);
        }

        return $console;
    }
Extend viserio console with commands.

@param \Psr\Container\ContainerInterface           $container
@param null|\Viserio\Component\Console\Application $console

@return null|\Viserio\Component\Console\Application