2017 © Pedro Peláez
 

library symfony-signal-helper

Symfony Console halper to handle process signals (like termination)

image

alexeyshockov/symfony-signal-helper

Symfony Console halper to handle process signals (like termination)

  • Friday, April 8, 2016
  • by alexeyshockov
  • Repository
  • 1 Watchers
  • 3 Stars
  • 12,515 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 13 % Grown

The README.md

SignalHelper

Helper for Symfony Console to handle process signals (like termination)., (*1)

Installation

$ composer require alexeyshockov/symfony-signal-helper

Usage

Just register the helper in your application (app/console, for example):, (*2)

#!/usr/bin/env php
<?php

// ...

$console = new Application();

$console->getHelperSet()->set(new SignalHelper());

$console->run($input);

And use it inside your command:, (*3)

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $helper = $this->getHelper('signal');
        $helper->listen();

        while (true) {
            if (count(array_intersect([SIGINT, SIGTERM], $helper->takeSignals())) > 0) {
                // Stop by any of SIGINT or SIGTERM.
                break;
            }

            // Some business logic.
        }
    }

The Versions

08/04 2016

dev-master

9999999-dev http://github.com/alexeyshockov/symfony-signal-helper

Symfony Console halper to handle process signals (like termination)

  Sources   Download

MIT

The Requires

 

console symfony

08/04 2016

v1.0.0

1.0.0.0 http://github.com/alexeyshockov/symfony-signal-helper

Symfony Console halper to handle process signals (like termination)

  Sources   Download

MIT

The Requires

 

console symfony