PHPackages                             logicalsteps/async - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. logicalsteps/async

ActiveLibrary[HTTP &amp; Networking](/categories/http)

logicalsteps/async
==================

async await implementation using generator function in php

2.0.0(5y ago)51.1k22MITPHPPHP &gt;=7.2CI failing

Since Sep 27Pushed 5y ago2 watchersCompare

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

READMEChangelogDependencies (16)Versions (8)Used By (2)

Async &amp; Await for PHP
=========================

[](#async--await-for-php)

[![Build Status](https://camo.githubusercontent.com/e590551201857c95b2a036996fefe2fb74948aba01dd829ece187c347a9cfea0/68747470733a2f2f7472617669732d63692e6f72672f6c6f676963616c73746570732f6173796e632e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/logicalsteps/async)[![Code Coverage](https://camo.githubusercontent.com/321ad48bd2d017abdbabe14fc3ebadd6d1ef66a1e57d515968dcd5cc5ead95cd/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c6f676963616c73746570732f6173796e632f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/logicalsteps/async/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/67c2f0711a993fc14b7f5ea503d44d838ddff661a04e2a13601a86f3423d07a0/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c6f676963616c73746570732f6173796e632f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/logicalsteps/async/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/9c3566e9aa35a9fdd2f467241c0bf59b4b768354fb61f0b0ab9d71746360bb57/68747470733a2f2f706f7365722e707567782e6f72672f6c6f676963616c73746570732f6173796e632f762f737461626c652e737667)](https://packagist.org/packages/logicalsteps/async)[![Total Downloads](https://camo.githubusercontent.com/e2ec5ddeb70403fc8f54c7a7e0f389419cd87fc25c90bd81143033529e84e1dc/68747470733a2f2f706f7365722e707567782e6f72672f6c6f676963616c73746570732f6173796e632f646f776e6c6f6164732e737667)](https://packagist.org/packages/logicalsteps/async)[![License](https://camo.githubusercontent.com/afb1a4d92e69c5e178bb62cff76f403db36f85a7ba3d01b40416d44d8cceaf94/68747470733a2f2f706f7365722e707567782e6f72672f6c6f676963616c73746570732f6173796e632f6c6963656e73652e737667)](https://packagist.org/packages/logicalsteps/async)

Simplify your asynchronous code and make it readable like synchronous code. It works similar to Async and await in other languages such as JavaScript and C#

It can be used standalone with callback functions. It also works with the promise interface of the following frameworks

- [ReactPHP](https://github.com/reactphp/promise)
- [Amp](https://amphp.org/amp/promises/)
- [Guzzle](https://github.com/guzzle/promises)
- [Httplug](https://github.com/php-http/promise)

It can do cooperative multitasking with the event loop interfaces of the following frameworks

- [ReactPHP](https://github.com/reactphp/event-loop)
- [Amp](https://amphp.org/amp/event-loop/)

Installation
------------

[](#installation)

Async can be installed with [Composer](http://getcomposer.org)by adding it as a dependency to your project's composer.json file. It can be done using the following command.

```
composer require logicalsteps/async
```

Please refer to [Composer's documentation](https://github.com/composer/composer/blob/master/doc/00-intro.md#introduction)for more detailed installation and usage instructions.

Usage
-----

[](#usage)

Consider the following example

```
