2017 © Pedro Peláez
 

library pnctl-event-loop-emitter

Pnctl event emitter for event loop

image

gos/pnctl-event-loop-emitter

Pnctl event emitter for event loop

  • Monday, April 9, 2018
  • by ProPheT777
  • Repository
  • 3 Watchers
  • 15 Stars
  • 232,276 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 9 Versions
  • 27 % Grown

The README.md

NOTE - This repository is no longer maintained, (*1)

PNCTL Event Loop Emitter

Latest Stable Version Total Downloads License, (*2)

Brings PNCTL event to event loop., (*3)

Install

composer require gos/pnctl-event-loop-emitter

Usage

use React\EventLoop\Factory;
use Gos\Component\PnctlEventLoopEmitter\PnctlEmitter;

$loop = Factory::create();

$pnctlEmitter = new PnctlEmitter($loop);

$pnctlEmitter->on(SIGTERM, function () use ($loop) {
    //do something

    $loop->stop();
});

$pnctlEmitter->on(SIGINT, function () use ($loop) {
    //do something

    $loop->stop();
});

$loop->run();

Example

Handle double CTRL+C, (*4)

use React\EventLoop\Factory;
use Gos\Component\PnctlEventLoopEmitter\PnctlEmitter;

$loop = Factory::create();
$pnctlEmitter = new PnctlEmitter($loop);

$pnctlEmitter->on(SIGINT, function () use ($loop) {
    $this->logger->notice('Press CTLR+C again to stop the server');

    if (SIGINT === pcntl_sigtimedwait([SIGINT], $siginfo, 5)) {
        $this->logger->notice('Stopping server ...');

        //Do your stuff to stop the server

        $loop->stop();

        $this->logger->notice('Server stopped !');
    } else {
        $this->logger->notice('CTLR+C not pressed, continue to run normally');
    }
});

$loop->run();

The Versions

09/04 2018

dev-master

9999999-dev https://github.com/GeniusesOfSymfony/PnctlEventLoopEmitter

Pnctl event emitter for event loop

  Sources   Download

MIT

The Requires

 

by Johann Saunier

event loop reactphp pnctl

09/04 2018

v0.1.7

0.1.7.0 https://github.com/GeniusesOfSymfony/PnctlEventLoopEmitter

Pnctl event emitter for event loop

  Sources   Download

MIT

The Requires

 

by Johann Saunier

event loop reactphp pnctl

17/02 2018

v0.1.6

0.1.6.0 https://github.com/GeniusesOfSymfony/PnctlEventLoopEmitter

Pnctl event emitter for event loop

  Sources   Download

MIT

The Requires

 

by Johann Saunier

event loop reactphp pnctl

06/05 2016

v0.1.5

0.1.5.0 https://github.com/GeniusesOfSymfony/PnctlEventLoopEmitter

Pnctl event emitter for event loop

  Sources   Download

MIT

The Requires

 

by Johann Saunier

event loop reactphp pnctl

22/03 2016

V0.1.4

0.1.4.0 https://github.com/GeniusesOfSymfony/PnctlEventLoopEmitter

Pnctl event emitter for event loop

  Sources   Download

MIT

The Requires

 

by Johann Saunier

event loop reactphp pnctl

26/02 2016

v0.1.3

0.1.3.0 https://github.com/GeniusesOfSymfony/PnctlEventLoopEmitter

Pnctl event emitter for event loop

  Sources   Download

MIT

The Requires

 

by Johann Saunier

event loop reactphp pnctl

08/07 2015

v0.1.2

0.1.2.0 https://github.com/GeniusesOfSymfony/PnctlEventLoopEmitter

Pnctl event emitter for event loop

  Sources   Download

MIT

The Requires

 

by Johann Saunier

event loop reactphp pnctl

08/07 2015

v0.1.1

0.1.1.0 https://github.com/GeniusesOfSymfony/PnctlEventLoopEmitter

Pnctl event emitter for event loop

  Sources   Download

MIT

The Requires

 

by Johann Saunier

event loop reactphp pnctl

02/06 2015

v0.1.0

0.1.0.0 https://github.com/GeniusesOfSymfony/PnctlEventLoopEmitter

Pnctl event emitter for event loop

  Sources   Download

MIT

The Requires

 

by Johann Saunier

event loop reactphp pnctl