Skip to content

Add-on for Linku/Feedback for using SymfonyStyle

License

Notifications You must be signed in to change notification settings

LinkuNijmegen/SymfonyStyleFeedback

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Linku/SymfonyStyleFeedback

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();
    }
}

About

Add-on for Linku/Feedback for using SymfonyStyle

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages