PHPackages                             moebius/loop - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. moebius/loop

ActiveLibrary[Queues &amp; Workers](/categories/queues)

moebius/loop
============

A solid event-loop API for writing applications that work across frameworks such as Amp or React, Slim, CodeIgniter, Laravel and Symfony.

1.0.108(3y ago)08472MITPHP

Since May 14Pushed 1y ago1 watchersCompare

[ Source](https://github.com/moebiusphp/loop)[ Packagist](https://packagist.org/packages/moebius/loop)[ Docs](https://github.com/moebiusphp/loop)[ RSS](/packages/moebius-loop/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (29)Used By (2)

Moebius\\Loop
=============

[](#moebiusloop)

An event-loop API for writing asynchronous code in traditional PHP code, while also working seamlessly with common asynchronous frameworks like React or Amp.

Moebius Loop provides an elegant and consistent API for working with non-blocking I/O which works equally well in classic synchronous PHP code as with fully asynchronous frameworks like React or Amp.

Laravel example
---------------

[](#laravel-example)

Moebius\\Loop can be used with most frameworks such as Laravel or Symfony. The only challenge with using asynchronous code with these frameworks, is that the framework will not wait for your promises to finish.

The solution is to use the `Moebius\Loop::await($promise)`function. As long as all the code that is asynchronous is written to use `Moebius\Loop` directly, or written for either React or Amp - then you can use `Moebius\Loop` to resolve the promise.

```
