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
libraryIntroduce 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 APISee 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()
andswitchMap()
, which are intended to work with higher-order Observables
This...