PHP code example of rodrigodiez / symfony-rich-console
1. Go to this page and download the library: Download rodrigodiez/symfony-rich-console library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rodrigodiez / symfony-rich-console example snippets
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());
}
#!/usr/bin/env php
use Rodrigodiez\Component\RichConsole\Console\Application;
//app/console
//...
$app = new Application(null, array('services.yml'));
//...