linku / feedback-symfonystyle
Add-on for linku/feedback for Symfony CLI feedback
Installs: 6 636
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 8
Forks: 1
Open Issues: 0
Requires
- php: ^7.2|~8.0|~8.1
- linku/feedback: ^1.0
- symfony/console: ^4.0|^5.0|^6.0
Requires (Dev)
- phpspec/prophecy-phpunit: ^2.0
- phpunit/phpunit: ^9.0
README
SymfonyStyleFeedback is an add-on for linku/feedback integrating SymfonyStyle I/O for Symfony Commands
Installation
composer require linku/feedback-symfonystyle
Use
See linku/feedback for general use instructions.
In your Symfony Command, you can use it as follows:
<?php namespace App\Command; use Linku\SymfonyStyleFeedback\SymfonyStyleFeedback; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; class MyCommand extends Command { public static $defaultName = 'app:my-command'; /** * @var MyService */ private $myService; public function __construct(MyService $myService) { parent::__construct(); $this->myService = $myService; } protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $this->myService->setFeedback( new SymfonyStyleFeedback($io) ); $this->myService->run(); } }