Properties

$loop

$loop : 

Type

$nextTickQueue

$nextTickQueue : 

Type

$futureTickQueue

$futureTickQueue : 

Type

$timerEvents

$timerEvents : 

Type

$readEvents

$readEvents : 

Type

$writeEvents

$writeEvents : 

Type

$running

$running : 

Type

Methods

__construct()

__construct() 

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.