PHPackages                             articus/container-interop-symfony-console - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. articus/container-interop-symfony-console

ActiveLibrary[CLI &amp; Console](/categories/cli)

articus/container-interop-symfony-console
=========================================

Symfony Console Application factory for PSR-11 containers

0.3(4y ago)05.2k↓50%MITPHPPHP ^7.1|^8.0

Since Feb 17Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Articus/ContainerInteropSymfonyConsole)[ Packagist](https://packagist.org/packages/articus/container-interop-symfony-console)[ RSS](/packages/articus-container-interop-symfony-console/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (5)Versions (7)Used By (0)

Container Interop for Symfony Console
=====================================

[](#container-interop-for-symfony-console)

[![GitHub Actions: Run tests](https://github.com/Articus/ContainerInteropSymfonyConsole/workflows/Run%20tests/badge.svg)](https://github.com/Articus/ContainerInteropSymfonyConsole/actions?query=workflow%3A%22Run+tests%22)[![Coveralls](https://camo.githubusercontent.com/d717e1aa5856bc9ae597d30ae3947526191181989da2ee132a9617f4520123b1/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f417274696375732f436f6e7461696e6572496e7465726f7053796d666f6e79436f6e736f6c652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/Articus/ContainerInteropSymfonyConsole?branch=master)[![Codacy](https://camo.githubusercontent.com/1fefb694bd27e6f21ce2d8dcf66636cab5c1769b1a53f0e5c05f237be2266977/68747470733a2f2f6170702e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3036303661323532313132623462623738343632353233343533343366363038)](https://www.codacy.com/gh/Articus/ContainerInteropSymfonyConsole/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Articus/ContainerInteropSymfonyConsole&utm_campaign=Badge_Grade)This package provides a small factory that allows creating [Symfony Console Application](https://symfony.com/doc/current/components/console.html) via PSR-11 compatible container. The code is dead simple, I just tired of copying it between projects :)

Quick start for application using [Laminas Service Manager](https://docs.laminas.dev/laminas-servicemanager/quick-start/) (fka [Zend Service Manager](https://docs.zendframework.com/zend-servicemanager/quick-start/))
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#quick-start-for-application-using-laminas-service-manager-fka-zend-service-manager)

Let's imagine that you have an existing application using [Laminas Service Manager](https://docs.laminas.dev/laminas-servicemanager/quick-start/) and it requires some console utility. First of all you need to add `articus/container-interop-symfony-console` package to your [composer.json](https://getcomposer.org/doc/04-schema.md#require). Next step is configuring your console application. Here is a small example (it is in YAML just for readability):

```
#Configuration root for Service Manager
dependencies:
  factories:
    Symfony\Component\Console\Application: ContainerInteropSymfonyConsole\Factory
    #Service for your console command, should extend \Symfony\Component\Console\Command\Command
    My\Command: My\CommandFactory

Symfony\Component\Console\Application:
  name: My App
  version: 1.2.3
  commands:
    - My\Command
```

Configuration should be available via `config` service of your container. Check `src/ContainerInteropSymfonyConsole/Options.php` for full list of available options.

Finally, you need to create PHP-script that will be your console application entrypoint. For example `bin/console.php` file with the following content:

```
#!/usr/bin/php
