Reactive Programming helps us write code that is concise, clear, and readable. Combining the power of reactive programming and PHP, one of the most widely used languages, will enable you to create web applications more pragmatically. PHP Reactive Programming will teach you the benefits of reactive programming via real-world examples with a hands-on approach. Reactive programming goes hand in hand with asynchronous programming; we’ll work a lot with event loops, blocking and non-blocking code, sub processes and IPC.We start with introducing PHP streams and event loop. We’ll also introduce the concept of higher-order Observables as a more advanced functionality of Rx. Moving on to more interesting aspects; you will implement a web socket backend by developing a browser game. You will learn to implement quite complex reactive systems while avoiding pitfalls such as circular dependencies by moving the RxJS logic from the frontend to the backend. The video will then focus on writing extendable RxPHP code by developing a code testing tool and also cover Using RxPHP on both the server and client side of the application. With a concluding video on reactive programming practices, this video will serve as a complete guide for you to start writing reactive applications in PHP.
About The Author
Martin Sikora has been professionally programming since 2006 for companies such as Miton CZ, Symbio Digital, and PRIA in various languages, mostly PHP and TypeScript. Since 2017, he's freelancing, trying to work on open source projects in TypeScript, PHP, Dart, C, and Python. He's been actively contributing to RxPHP and RxJS 5 on both Github and Stack Overflow. He is a Zend certified engineer and was a member of the winning team during Google Dart Hackathon 2012 in Prague. His first publication was Dart Essentials, by Packt, published in May 2015.
Promises represent a single value. In this video, we are going to look at different methods used to handle promises.
In this video, we are going to introduce PHP Streams API with examples and see what benefits it brings with minimal. We are going examine the internals of StreamSelectLoopclass and be aware of when working with non-blocking code in event loops
A higher-order Observable is an Observable that emits other Observables. In this video, we are going to use mergeAll(), concatAll() and switchLatest().
Sometimes the Observable is emitting values so fast that the consumer is not able to handle them. This could lead to significant memory or CPU usage, which we definitely want to avoid. There are two groups of operators suitable for backpressure: lossy and loss-less.
Process Observable will spawn a new Sub-process, emit its output with onNextand also properly handle onErrorand onCompletenotifications.
The Server Manager is going to be a CLI application that will be responsible for spawning WebSocket servers, where each server is a standalone application itself, with its own clients and chat history.
We need to first create the server with stream_socket_server() to use stream_socket_client() to connect to a socket server. In this video, we are going to implement the game server stream endpoint class and combine the switchLatest() and combineLatest() operators.
There are multiple different variants of the Subject class for more specific use cases where all of them are relevant to multicasting.
Multicasting means sharing a single subscription among multiple Observers via an instance of a Subject class. All multicasting operators are internally based on the general multicast() operator that implements their most common functionality.
PHP Parser is a library that takes a source code written in PHP, passes it through a lexical analyzer, and creates its respective syntax tree. This is very useful for static code analysis, where we want to check our own code not only for syntactic errors but also for satisfying certain quality criteria
Gearman is a framework for distributing work among multiple processes and machines. Due to its functionality, it can serve as a manager, load balancer, or interface between different languages with no single point of failure.
In this video, we are going to study advanced operator such as zip(),window(), materialize() and dematerialize() operators.
Each observer can take as an optional parameter an error handler that is called on error notification. If we do specify the error callable, we can handle the error however we want to.
Apart from creating custom Observables, we know that we can use the Observable::create() static method or an instance of the Subject class to emit items.
When developing PHP applications, it's handy to enable the Xdebug extension that we can use to debug our code. However this comes with the cost of reduced performance, higher memory usage, and a limited number of possible nested function calls.
When we have an observer we'll stop receiving items when the source Observable completes or when we manually unsubscribe. By unsubscribing we usually mean that we don't want to be receiving items any more.
lift() method uses custom operators in Observable chains. This method takes as aparameter the so called operator factory, which is a callable that returns an instance of the operator we want to use.
We use a couple of DirectoryIteratorsto recursively get all files in a directory and all its subdirectories. When iterating files, we might want to filter not only by filenames, but also by file size or access restrictions.
Packt has been committed to developer learning since 2004. A lot has changed in software since then - but Packt has remained responsive to these changes, continuing to look forward at the trends and tools defining the way we work and live. And how to put them to work.
With an extensive library of content - more than 4000 books and video courses -Packt's mission is to help developers stay relevant in a rapidly changing world. From new web frameworks and programming languages, to cutting edge data analytics, and DevOps, Packt takes software professionals in every field to what's important to them now.
From skills that will help you to develop and future proof your career to immediate solutions to every day tech challenges, Packt is a go-to resource to make you a better, smarter developer.
Packt Udemy courses continue this tradition, bringing you comprehensive yet concise video courses straight from the experts.