PHPackages                             rodrigodiez/symfony-rich-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. rodrigodiez/symfony-rich-console

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

rodrigodiez/symfony-rich-console
================================

Integrates both Dependency Injection and Event Dispatcher components into non framework Symfony Console applications

1.0.1(12y ago)4551[1 PRs](https://github.com/rodrigodiez/symfony-rich-console/pulls)MITPHPPHP &gt;=5.3.3

Since Jan 7Pushed 9y agoCompare

[ Source](https://github.com/rodrigodiez/symfony-rich-console)[ Packagist](https://packagist.org/packages/rodrigodiez/symfony-rich-console)[ RSS](/packages/rodrigodiez-symfony-rich-console/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (6)Versions (4)Used By (0)

Symfony rich console
====================

[](#symfony-rich-console)

This component integrates both *Symfony Dependency Injection* and *Symfony Event Dispatcher* components into *Symfony Console* applications.

> Note: This is only intended if dealing with *Symfony Console* **standalone** applications, not web framework ones.

[![Scrutinizer Quality Score](https://camo.githubusercontent.com/c9f86bc48670a06e40fb271e5778c7ce892c81e621608f07ad42d06abecba34c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f726f647269676f6469657a2f73796d666f6e792d726963682d636f6e736f6c652f6261646765732f7175616c6974792d73636f72652e706e673f733d31336562333261653331376635306366356264643561313636353534646437326530623231636463)](https://scrutinizer-ci.com/g/rodrigodiez/symfony-rich-console/)[![SensioLabsInsight](https://camo.githubusercontent.com/65227f375d05511bce3d347278a5730953adb8d5999d40e772c7ab3ee1650bd9/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f61383239376535662d376664312d343937342d623066302d6366636263366132383931372f6d696e692e706e67)](https://insight.sensiolabs.com/projects/a8297e5f-7fd1-4974-b0f0-cfcbc6a28917)

Example:
--------

[](#example)

```
    public function run(InputInterface $input, OutputInterface $output)
    {
        // You can access services
        $myService = $this->container->get('my_service');
        $input->writeln('My service says ' . $myService->hello());

        // You can get parameters
        $myParam = $this->container->getParameter('my_param');

        // You can dispatch events and these will be received by their listeners / subscribers
        $event = new Event();
        $this->container->get('event_dispatcher')->dispatch('custom.event', $event);
        $input->writeln('My listeners says ' . $event->getValue());
    }
```

Installation
------------

[](#installation)

### 1. Download it using composer

[](#1-download-it-using-composer)

Add `rodrigodiez/symfony-rich-console` to your `composer.json`

```
{
    "require": {
        "rodrigodiez/symfony-rich-console": "dev-master"
    }
}
```

Now, tell composer to download the component by typing

```
$ php composer.phar update rodrigodiez/symfony-rich-console
```

### 2. Create a console

[](#2-create-a-console)

You need a entry point file to instantiate and run your application. You can create it at `app/console`.

```
#!/usr/bin/env php
