Properties

$eventBase

$eventBase : 

Type

$nextTickQueue

$nextTickQueue : 

Type

$futureTickQueue

$futureTickQueue : 

Type

$timerCallback

$timerCallback : 

Type

$timerEvents

$timerEvents : 

Type

$streamCallback

$streamCallback : 

Type

$streamEvents

$streamEvents : 

Type

$streamFlags

$streamFlags : 

Type

$readListeners

$readListeners : 

Type

$writeListeners

$writeListeners : 

Type

$running

$running : 

Type

Methods

__construct()

__construct(\EventConfig  $config = null) 

Parameters

\EventConfig $config

addReadStream()

addReadStream(resource  $stream, callable  $listener) 

Register a listener to be notified when a stream is ready to read.

Parameters

resource $stream

The PHP stream resource to check.

callable $listener

Invoked when the stream is ready.

addWriteStream()

addWriteStream(resource  $stream, callable  $listener) 

Register a listener to be notified when a stream is ready to write.

Parameters

resource $stream

The PHP stream resource to check.

callable $listener

Invoked when the stream is ready.

removeReadStream()

removeReadStream(resource  $stream) 

Remove the read event listener for the given stream.

Parameters

resource $stream

The PHP stream resource.

removeWriteStream()

removeWriteStream(resource  $stream) 

Remove the write event listener for the given stream.

Parameters

resource $stream

The PHP stream resource.

removeStream()

removeStream(resource  $stream) 

Remove all listeners for the given stream.

Parameters

resource $stream

The PHP stream resource.

addTimer()

addTimer(integer|float  $interval, callable  $callback) : \React\EventLoop\Timer\TimerInterface

Enqueue a callback to be invoked once after the given interval.

The execution order of timers scheduled to execute at the same time is not guaranteed.

Parameters

integer|float $interval

The number of seconds to wait before execution.

callable $callback

The callback to invoke.

Returns

\React\EventLoop\Timer\TimerInterface

addPeriodicTimer()

addPeriodicTimer(integer|float  $interval, callable  $callback) : \React\EventLoop\Timer\TimerInterface

Enqueue a callback to be invoked repeatedly after the given interval.

The execution order of timers scheduled to execute at the same time is not guaranteed.

Parameters

integer|float $interval

The number of seconds to wait before execution.

callable $callback

The callback to invoke.

Returns

\React\EventLoop\Timer\TimerInterface

isTimerActive()

isTimerActive(\React\EventLoop\Timer\TimerInterface  $timer) : boolean

Check if a given timer is active.

Parameters

\React\EventLoop\Timer\TimerInterface $timer

The timer to check.

Returns

boolean —

True if the timer is still enqueued for execution.

nextTick()

nextTick(callable  $listener) 

Schedule a callback to be invoked on the next tick of the event loop.

Callbacks are guaranteed to be executed in the order they are enqueued, before any timer or stream events.

Parameters

callable $listener

The callback to invoke.

futureTick()

futureTick(callable  $listener) 

Schedule a callback to be invoked on a future tick of the event loop.

Callbacks are guaranteed to be executed in the order they are enqueued.

Parameters

callable $listener

The callback to invoke.

tick()

tick() 

Perform a single iteration of the event loop.

run()

run() 

Run the event loop until there are no more tasks to perform.

stop()

stop() 

Instruct a running event loop to stop.

subscribeStreamEvent()

subscribeStreamEvent(resource  $stream, integer  $flag) 

Create a new ext-event Event object, or update the existing one.

Parameters

resource $stream
integer $flag

Event::READ or Event::WRITE

unsubscribeStreamEvent()

unsubscribeStreamEvent(resource  $stream, integer  $flag) 

Update the ext-event Event object for this stream to stop listening to the given event type, or remove it entirely if it's no longer needed.

Parameters

resource $stream
integer $flag

Event::READ or Event::WRITE

createTimerCallback()

createTimerCallback() 

Create a callback used as the target of timer events.

A reference is kept to the callback for the lifetime of the loop to prevent "Cannot destroy active lambda function" fatal error from the event extension.

createStreamCallback()

createStreamCallback() 

Create a callback used as the target of stream events.

A reference is kept to the callback for the lifetime of the loop to prevent "Cannot destroy active lambda function" fatal error from the event extension.