#!/usr/bin/env php get('config')['laminas-cli']['commands'] ?? [], fn ($c, string $command) => str_starts_with($command, $commandsPrefix), ); $registeredCommands = []; foreach ($commands as $newName => $commandServiceName) { [, $oldName] = explode($commandsPrefix, $newName); $registeredCommands[$oldName] = $commandServiceName; $container->addDelegator($commandServiceName, static function ($c, $n, callable $factory) use ($oldName) { /** @var Command $command */ $command = $factory(); $command->setAliases([$oldName]); return $command; }); } $commandLine = new CommandLine('Mezzio web server', $version); $commandLine->setAutoExit(true); $commandLine->setCommandLoader(new ContainerCommandLoader($container, $registeredCommands)); $commandLine->run();