Chapter 6. PHP Streams API and Higher-Order Observables
In this chapter, we'll introduce a lot of new features that we need for the next chapter. Almost everything covered in this chapter is related to PHP Streams API, Promises and event loops (reactphp/event-loop
project in our case). This also includes a couple of more advanced RxPHP operators working with so-called higher-order Observables.
In particular, in this chapter, we'll do the following:
- Quickly look at using Promises in PHP with theÂ
reactphp/promise
library - Introduce PHP Streams API and, with examples, see what benefits it brings with minimal or no effort
- Examine the internals ofÂ
StreamSelectLoop
class, this time in the context of PHP Streams API - See what caveats we need to be aware of when working with non-blocking code in event loops
- Talk about higher-order Observables
- Introduce four new and more advanced operators,Â
concatAll()
,ÂmergeAll()
,ÂcombineLatest()
andÂswitchMap()
, which are...