Download the PHP package pbergman/event-loop without Composer

On this page you can find all versions of the php package pbergman/event-loop. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package event-loop

EventLoop

This a simple light weight (synchronous) event loop, it uses watchers that can be registered and those will be called every tick (iteration). I have started this project because i needed something like this for a fork application that i was working on and tried ev but was missing some things and didn`t really work for me. The loop will run until there are no more active watchers, is stopped or is limited by the given argument of the run method. The order you add watcher is the order the going to be called (FIFO). If the watcher is stopped and the loop will keep it in the queue so it can be started later. If you call the finished method the watcher will removed from the queue.

Loop

This is the main class where you can register the watchers and holds the loop logic. The loop is build around the SplQueue and evey watcher in enqueued and dequeued in the tick. When the watcher is not marked as finished it will be enqueued again and if marked as stopped it not be called again until it is started again.

add(WatcherInterface $watcher)

This method can be used to register you custom watcher (a custom watcher should implement WatcherInterface or extend AbstractWatcher) or a stopped watcher that can be activated later in the loop.

peekBottom()

Get the first registered watcher.

peekTop()

Get the last registered watcher.

filter(callable $filter)

Do filter over the registered watchers (similar as array filter).

grep(callable $filter)

do grep filter on watcher and return a array that match that criteria

getWatcher()

this will return a iterator (generator) that returns the next watcher every call

run( $limit = null)

This will run the loop, if no limit is given it will run till all watcher are finished.

stop()

This will stop the loop from running.

getTicks()

Get the ticks (iteration).

setMinDuration()

The minimal duration, if a tick was shorter or longer thant this given value it will sleep till next tick. Default it is 0.2 second.

addCallback(callable $callback)

Add a callback watcher, this callback will be called every tick.

addInterval( $interval, callable $callback)

Add a interval watcher, if interval for example 0.4 given and min duration is 0.2 the given callback will be called every 2 ticks.

addScheduled(\DateTime $time, callable $callback)

Add a scheduled watcher, this will be called every tick when given time is past.

addPeriodic(\DateTime $start, \DateTime $stop, $interval, callable $callback)

Add a periodic watcher, this callback will be called every given interval after given start date and will end when stop time is reached.

addSignal($signal, callable $callback)

Add a signal watcher, the given callback will be called when i signal if send to this process.

count()

Returns the count of registered watchers.

reset()

Will do reset on the internals.


All versions of event-loop with dependencies

PHP Build Version
Package Version
Requires php Version 5.6.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package pbergman/event-loop contains the following files

Loading the files please wait ....