2017 © Pedro Peláez
 

library symfony-console-subscriber

Console Subscriber for Symfony Console

image

mf/symfony-console-subscriber

Console Subscriber for Symfony Console

  • Sunday, November 12, 2017
  • by MortalFlesh
  • Repository
  • 1 Watchers
  • 1 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 18 % Grown

The README.md

Symfony Console Subscriber

Latest Stable Version Tests and linting Coverage Status Total Downloads License, (*1)

Console Subscriber for Symfony Console., (*2)

Installation

composer require mf/symfony-console-subscriber

Usage

Comparision

It is same as using SymfonyStyle directly, you just use EventDispatcher to handle your events., (*3)

SymfonyStyle, (*4)

$io->note('note');

// vs Dispatching

$eventDispatcher->dispatch(new NoteEvent('Some note.'));

initialization

$io = new SymfonyStyle();
$subscriber = new ConsoleSubscriber();

$subscriber->setIo($io);

$eventDispatcher->addSubscriber($subscriber);

dispatch

Note, (*5)

$eventDispatcher->dispatch(new NoteEvent('Some note.'));

Progress, (*6)

$items = [1, 2, 3];

$eventDispatcher->dispatch(new ProgressStartEvent($items));

foreach($items as $i) {
    // do something

    $eventDispatcher->dispatch(new ProgressAdvanceEvent());
}

$eventDispatcher->dispatch(new ProgressFinishedEvent('All items were iterated!'));

The Versions

12/11 2017

dev-master

9999999-dev

Console Subscriber for Symfony Console

  Sources   Download

MIT

The Requires

 

The Development Requires

by Petr Chromec

05/11 2017
29/10 2017