Advanced Concepts of PHP Reactive Programming
0.0 (0 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
1 student enrolled
Wishlisted Wishlist

Please confirm that you want to add Advanced Concepts of PHP Reactive Programming to your Wishlist.

Add to Wishlist

Advanced Concepts of PHP Reactive Programming

Combining the power of reactive programming and PHP
0.0 (0 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
1 student enrolled
Created by Packt Publishing
Last updated 9/2017
English [Auto-generated]
Current price: $10 Original price: $125 Discount: 92% off
5 hours left at this price!
30-Day Money-Back Guarantee
  • 1.5 hours on-demand video
  • 1 Supplemental Resource
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • Get introduce to the PHP Streams API and event loops
  • Builds a chat manager, server and client as three separate processes that communicate with each other via Unix sockets
  • Learn the concept of multicasting in Rx and all the components that RxPHP
  • Introduce the Gearman framework as a way to distribute work among multiple processes
  • Take a look at advanced operator and techniques in RxPHP
View Curriculum
  • This course consists of a problem solution approach. This course includes both RxPHP 1 and RxPHP 2.

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.

Who is the target audience?
  • This course is aimed at people with a solid knowledge of PHP and programming languages in general. We also assume they have at least a little experience with other technologies such as JavaScript, Node js, and others.
Students Who Viewed This Course Also Viewed
Curriculum For This Course
19 Lectures
PHP Streams API and Higher-Order Observables
4 Lectures 30:55

This video gives an overview of the entire course.

Preview 02:41

Promises represent a single value. In this video, we are going to look at different methods used to handle promises.

Using Promises in PHP

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

PHP Streams API

A higher-order Observable is an Observable that emits other Observables. In this video, we are going to use mergeAll(), concatAll() and switchLatest().

Higher-Order Observable
Implementing Socket IPC
4 Lectures 20:06

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.

Preview 04:50

Process Observable will spawn a new Sub-process, emit its output with onNextand also properly handle onErrorand onCompletenotifications.

Implementing ProcessObsevable

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.

Server Manager Application

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.

Server Manager and the Unix Socket Server
Multicasting in RxPHP
2 Lectures 13:29

There are multiple different variants of the Subject class for more specific use cases where all of them are relevant to multicasting.

Preview 02:15

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.

Multithreaded and Distributed Computing with Gearman
2 Lectures 16:49

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

Preview 09:14

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.

Introduction to Gearman
Using Advanced Operators and Techniques in RxPHP
7 Lectures 21:13

In this video, we are going to study advanced operator such as zip(),window(), materialize() and dematerialize() operators.

Preview 05:14

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.

Error Handling in RxPHPOperator Chains

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.

The Observable::create() Method Versus the Subject Class

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.

Call Stack Length and EventLoopScheduler

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.

Unsubscribing Versus Completing an Observable

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.

Anonymous Operators

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.

Writing a Custom DirectoryIteratorObservable
About the Instructor
Packt Publishing
3.9 Average rating
8,109 Reviews
58,434 Students
686 Courses
Tech Knowledge in Motion

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.