- Can I use laminas/laminas-cli in Laravel, or should I use Artisan?
- Technically yes, but it duplicates Artisan. Both are console kernels built on symfony/console; Artisan adds scheduling, --env, Tinker, and package discovery, while laminas-cli resolves commands from a PSR-11 container using a laminas-cli.commands map. For a pure Laravel app, register the same Symfony Console Command classes in Artisan instead of adding a second runner.
- How do I test commands built for laminas-cli?
- Commands are plain Symfony Console Command subclasses, so you can test them with Symfony's CommandTester or with Laravel's $this->artisan() when the same classes are registered in Artisan. Keep command logic container-agnostic and inject dependencies through the constructor. That way the same tests work under either runner without booting laminas-cli.
- How do I install laminas/laminas-cli?
- Install it with Composer using composer require laminas/laminas-cli. It expects a PSR-11 container and a config service that returns a laminas-cli.commands map. In a Laminas MVC or Mezzio application you wire that through the framework's config and dependency factories; in Laravel you need an adapter or the --container option.
- Does laminas-cli support Laravel 11 or 12?
- There is no first-party Laravel integration, so support depends on PHP and Symfony Console version constraints rather than Laravel majors. Recent releases track Symfony versions and PHP floors, for example 1.14 dropped Symfony 6 and 1.13 dropped PHP 8.1. Check that matrix against your app's PHP version before adding it; Laravel 10 projects on PHP 8.1 are excluded from current releases.
- What is the --container option in laminas-cli?
- The --container=<path> global option, added in 1.1.0 and hardened in 1.1.1, lets you point laminas-cli at a PHP file that boots and returns a PSR-11 container. It is the clean seam for booting Laravel's application kernel and exposing config plus command factories without monkey-patching the framework. You still need a config service that returns the laminas-cli.commands array.
- How do I share console commands between a Laravel app and a Laminas or Mezzio app?
- Extract the shared commands into a standalone Composer package that depends only on symfony/console and PSR-11. In Laravel, register them in App\Console\Kernel or via withCommands() in bootstrap/app.php for Laravel 11+ style. In the Laminas or Mezzio service, add laminas/laminas-cli and map the same classes under laminas-cli.commands with a factory entry per command.
- Is laminas/laminas-cli actively maintained?
- It is maintained in a maintenance-mode posture by a small team, with recent releases mostly dependency bumps from Renovate and sparse feature work. The repository has low visibility, around 56 stars, and no first-party Laravel integration. Treat it as a stable but low-velocity package and pin versions carefully.
- What are alternatives to laminas-cli for Laravel developers?
- Use Laravel Artisan and register Symfony Console Command classes directly in the kernel, which adds zero new dependencies. For cross-runtime reuse, a framework-agnostic command package depending only on symfony/console and PSR-11 gives the same portability with lower coupling. Symfony Console alone is the common denominator between Laravel and Laminas runtimes.
- How do I register a command as a service in laminas-cli?
- Write a class extending Symfony\Component\Console\Command\Command, register it as a service in your PSR-11 container, and map it in config under laminas-cli.commands. The runner resolves that map and hands the resulting commands to Symfony Console. In Laminas MVC or Mezzio you add a ServiceManager or dependencies factory entry per command.
- What risks should I consider before adding laminas-cli to a Laravel project?
- The dominant risk is Symfony major-version churn: each Laminas minor can invalidate your Laravel version pairing, as when 1.10 dropped Symfony 5 and 1.14 dropped Symfony 6 while permitting Symfony 8. Dual bootstrapping also means two config-cache and .env paths that can silently diverge, and the package lacks Artisan features such as scheduling, --env, and Tinker. If you do not own Laminas or Mezzio services, there is no standing use case for the runner.