11# clue/reactphp-block [ ![ Build Status] ( https://travis-ci.org/clue/reactphp-block.svg?branch=master )] ( https://travis-ci.org/clue/reactphp-block )
22
33Lightweight library that eases integrating async components built for
4- [ React PHP ] ( http ://reactphp.org/) in a traditional, blocking environment.
4+ [ ReactPHP ] ( https ://reactphp.org/) in a traditional, blocking environment.
55
6- ** Table of contents**
7-
8- * [ Introduction] ( #introduction )
9- * [ Quickstart example] ( #quickstart-example )
10- * [ Usage] ( #usage )
11- * [ sleep()] ( #sleep )
12- * [ await()] ( #await )
13- * [ awaitAny()] ( #awaitany )
14- * [ awaitAll()] ( #awaitall )
15- * [ Install] ( #install )
16- * [ Tests] ( #tests )
17- * [ License] ( #license )
18-
19- ## Introduction
20-
21- [ React PHP] ( http://reactphp.org/ ) provides you a great set of base components and
6+ [ ReactPHP] ( https://reactphp.org/ ) provides you a great set of base components and
227a huge ecosystem of third party libraries in order to perform async operations.
238The event-driven paradigm and asynchronous processing of any number of streams
249in real time enables you to build a whole new set of application on top of it.
@@ -27,18 +12,28 @@ likely result in you relying on a whole new software architecture.
2712
2813But let's face it: Your day-to-day business is unlikely to allow you to build
2914everything from scratch and ditch your existing production environment.
30-
3115This is where this library comes into play:
3216
33- * Let's block React PHP*
34-
17+ * Let's block ReactPHP*
3518More specifically, this library eases the pain of integrating async components
3619into your traditional, synchronous (blocking) application stack.
3720
21+ ** Table of contents**
22+
23+ * [ Quickstart example] ( #quickstart-example )
24+ * [ Usage] ( #usage )
25+ * [ sleep()] ( #sleep )
26+ * [ await()] ( #await )
27+ * [ awaitAny()] ( #awaitany )
28+ * [ awaitAll()] ( #awaitall )
29+ * [ Install] ( #install )
30+ * [ Tests] ( #tests )
31+ * [ License] ( #license )
32+
3833### Quickstart example
3934
4035The following example code demonstrates how this library can be used along with
41- an [ async HTTP client] ( https://github.com/clue/php -buzz-react ) to process two
36+ an [ async HTTP client] ( https://github.com/clue/reactphp -buzz ) to process two
4237non-blocking HTTP requests and block until the first (faster) one resolves.
4338
4439``` php
@@ -79,7 +74,7 @@ Alternatively, you can also refer to them with their fully-qualified name:
7974
8075``` php
8176\Clue\React\Block\await(…);
82- ```
77+ ```
8378
8479### EventLoop
8580
@@ -91,7 +86,7 @@ in order to make it run (block) until your conditions are fulfilled.
9186$loop = React\EventLoop\Factory::create();
9287```
9388
94- #### sleep()
89+ ### sleep()
9590
9691The ` sleep($seconds, LoopInterface $loop) ` method can be used to wait/sleep for $time seconds.
9792
@@ -111,7 +106,7 @@ this function actually executes the loop in the meantime.
111106This is particularly useful if you've attached more async tasks to the same loop instance.
112107If there are no other (async) tasks, this will behave similar to ` sleep() ` .
113108
114- #### await()
109+ ### await()
115110
116111The ` await(PromiseInterface $promise, LoopInterface $loop, $timeout = null) `
117112function can be used to block waiting for the given $promise to resolve.
@@ -145,7 +140,7 @@ triggers, this will `cancel()` the promise and throw a `TimeoutException`.
145140This implies that if you pass a really small (or negative) value, it will still
146141start a timer and will thus trigger at the earliest possible time in the future.
147142
148- #### awaitAny()
143+ ### awaitAny()
149144
150145The ` awaitAny(array $promises, LoopInterface $loop, $timeout = null) `
151146function can be used to wait for ANY of the given promises to resolve.
@@ -174,7 +169,7 @@ triggers, this will `cancel()` all pending promises and throw a `TimeoutExceptio
174169This implies that if you pass a really small (or negative) value, it will still
175170start a timer and will thus trigger at the earliest possible time in the future.
176171
177- #### awaitAll()
172+ ### awaitAll()
178173
179174The ` awaitAll(array $promises, LoopInterface $loop, $timeout = null) `
180175function can be used to wait for ALL of the given promises to resolve.
@@ -209,19 +204,27 @@ start a timer and will thus trigger at the earliest possible time in the future.
209204
210205## Install
211206
212- The recommended way to install this library is [ through Composer] ( http://getcomposer.org ) .
213- [ New to Composer?] ( http://getcomposer.org/doc/00-intro.md )
207+ The recommended way to install this library is [ through Composer] ( https://getcomposer.org ) .
208+ [ New to Composer?] ( https://getcomposer.org/doc/00-intro.md )
209+
210+ This project follows [ SemVer] ( https://semver.org/ ) .
211+ This will install the latest supported version:
214212
215213``` bash
216- $ composer require clue/block-react:^1.2
214+ $ composer require clue/block-react:^1.3
217215```
218216
219217See also the [ CHANGELOG] ( CHANGELOG.md ) for details about version upgrades.
220218
219+ This project aims to run on any platform and thus does not require any PHP
220+ extensions and supports running on legacy PHP 5.3 through current PHP 7+ and
221+ HHVM.
222+ It's * highly recommended to use PHP 7+* for this project.
223+
221224## Tests
222225
223226To run the test suite, you first need to clone this repo and then install all
224- dependencies [ through Composer] ( http ://getcomposer.org) :
227+ dependencies [ through Composer] ( https ://getcomposer.org) :
225228
226229``` bash
227230$ composer install
@@ -235,4 +238,7 @@ $ php vendor/bin/phpunit
235238
236239## License
237240
238- MIT
241+ This project is released under the permissive [ MIT license] ( LICENSE ) .
242+
243+ > Did you know that I offer custom development services and issuing invoices for
244+ sponsorships of releases and for contributions? Contact me (@clue ) for details.
0 commit comments