PHP Reactive Programming

Leverage the power of reactive programming with PHP
Preview in Mapt

PHP Reactive Programming

Martin Sikora

Leverage the power of reactive programming with PHP
Mapt Subscription
FREE
$29.99/m after trial
eBook
$10.00
RRP $35.99
Save 72%
Print + eBook
$44.99
RRP $44.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$10.00
$44.99
$29.99 p/m after trial
RRP $35.99
RRP $44.99
Subscription
eBook
Print + eBook
Start 14 Day Trial

Frequently bought together


PHP Reactive Programming Book Cover
PHP Reactive Programming
$ 35.99
$ 10.00
PHP Microservices Book Cover
PHP Microservices
$ 35.99
$ 10.00
Buy 2 for $20.00
Save $51.98
Add to Cart

Book Details

ISBN 139781786462879
Paperback364 pages

Book Description

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. You will create multiple projects showing RxPHP in action alone and in combination with other libraries.

The book starts with a brief introduction to reactive programming, clearly explaining the importance of building reactive applications. You will use the RxPHP library, built a reddit CLI using it, and also re-implement the Symfony3 Event Dispatcher with RxPHP. You will learn how to test your RxPHP code by writing unit tests. 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 book 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 chapter on reactive programming practices in other languages, this book will serve as a complete guide for you to start writing reactive applications in PHP.

Table of Contents

Chapter 1: Introduction to Reactive Programming
Imperative programming
Declarative programming
Sequential and parallel programming
Asynchronous programming
Functional programming
Reactive programming
Reactive Extensions
Introducing RxPHP
Summary
Chapter 2: Reactive Programming with RxPHP
Basic principles of Reactive Extensions
Naming conventions in Reactive Extensions
Components of RxPHP
Writing the DebugSubject class
Writing JSONDecodeOperator
Writing CURLObservable
The proc_open() and non-blocking fread()
Event loop and RxPHP
Summary
Chapter 3: Writing a Reddit Reader with RxPHP
Examining RxPHP's internals
Observable::create() and Observable::defer()
Writing a Reddit reader using RxPHP
Non-blocking CURLObservable
Types of disposable classes
Summary
Chapter 4: Reactive versus a Typical Event-Driven Approach
Handling error states in operator chains
The concat() and merge() operators
Writing a reactive event dispatcher
Summary
Chapter 5: Testing RxPHP Code
The doOn*() operators
Installing the PHPUnit package
Basics of writing tests using PHPUnit
Testing RxPHP code
Testing SumOperator
Testing ForkJoinObservable
Summary
Chapter 6: PHP Streams API and Higher-Order Observables
Using Promises in PHP
PHP Streams API
Higher-order Observables
Summary
Chapter 7: Implementing Socket IPC and WebSocket Server/Client
Backpressure in Reactive Extensions
Implementing ProcessObservable
Server Manager application
Server Manager and the Unix socket server
Implementing a WebSocket server
Implementing a WebSocket client
Summary
Chapter 8: Multicasting in RxPHP and PHP7 pthreads Extension
Subjects
Multicasting in RxPHP
PHP pthreads extension
RxPHP and pthreads
Summary
Chapter 9: Multithreaded and Distributed Computing with pthreads and Gearman
Introduction to the PHP Parser library
Implementing ThreadPoolOperator
Introduction to Gearman
Summary
Chapter 10: Using Advanced Operators and Techniques in RxPHP
The zip() operator
The window() operator
The materialize() and dematerialize() operators
Error handling in RxPHP operator chains
The Observable::create() method versus the Subject class
Call stack length and EventLoopScheduler
Unsubscribing versus completing an Observable
Anonymous operators
Writing a custom DirectoryIteratorObservable
FTP client with RxPHP
Summary
Chapter 11: Reusing RxPHP Techniques in RxJS
What is RxJS?
A quick introduction to RxJS 5 in Node.js
Higher-order Observables in RxJS 5 and RxPHP
Operators specific for RxJS 5
Summary

What You Will Learn

  • How to work with the RxPHP library and see what it offers via many examples
  • Use the RxPHP library in combination with Symfony Console
  • The different approaches to using Symfony3's Event Dispatcher component
  • Test your reactive PHP code using PHPUnit
  • Analyze PHP source code and apply a custom set of rules by building a CLI tool

Authors

Table of Contents

Chapter 1: Introduction to Reactive Programming
Imperative programming
Declarative programming
Sequential and parallel programming
Asynchronous programming
Functional programming
Reactive programming
Reactive Extensions
Introducing RxPHP
Summary
Chapter 2: Reactive Programming with RxPHP
Basic principles of Reactive Extensions
Naming conventions in Reactive Extensions
Components of RxPHP
Writing the DebugSubject class
Writing JSONDecodeOperator
Writing CURLObservable
The proc_open() and non-blocking fread()
Event loop and RxPHP
Summary
Chapter 3: Writing a Reddit Reader with RxPHP
Examining RxPHP's internals
Observable::create() and Observable::defer()
Writing a Reddit reader using RxPHP
Non-blocking CURLObservable
Types of disposable classes
Summary
Chapter 4: Reactive versus a Typical Event-Driven Approach
Handling error states in operator chains
The concat() and merge() operators
Writing a reactive event dispatcher
Summary
Chapter 5: Testing RxPHP Code
The doOn*() operators
Installing the PHPUnit package
Basics of writing tests using PHPUnit
Testing RxPHP code
Testing SumOperator
Testing ForkJoinObservable
Summary
Chapter 6: PHP Streams API and Higher-Order Observables
Using Promises in PHP
PHP Streams API
Higher-order Observables
Summary
Chapter 7: Implementing Socket IPC and WebSocket Server/Client
Backpressure in Reactive Extensions
Implementing ProcessObservable
Server Manager application
Server Manager and the Unix socket server
Implementing a WebSocket server
Implementing a WebSocket client
Summary
Chapter 8: Multicasting in RxPHP and PHP7 pthreads Extension
Subjects
Multicasting in RxPHP
PHP pthreads extension
RxPHP and pthreads
Summary
Chapter 9: Multithreaded and Distributed Computing with pthreads and Gearman
Introduction to the PHP Parser library
Implementing ThreadPoolOperator
Introduction to Gearman
Summary
Chapter 10: Using Advanced Operators and Techniques in RxPHP
The zip() operator
The window() operator
The materialize() and dematerialize() operators
Error handling in RxPHP operator chains
The Observable::create() method versus the Subject class
Call stack length and EventLoopScheduler
Unsubscribing versus completing an Observable
Anonymous operators
Writing a custom DirectoryIteratorObservable
FTP client with RxPHP
Summary
Chapter 11: Reusing RxPHP Techniques in RxJS
What is RxJS?
A quick introduction to RxJS 5 in Node.js
Higher-order Observables in RxJS 5 and RxPHP
Operators specific for RxJS 5
Summary

Book Details

ISBN 139781786462879
Paperback364 pages
Read More

Read More Reviews

Recommended for You

PHP Microservices Book Cover
PHP Microservices
$ 35.99
$ 10.00
PHP 7 Data Structures and Algorithms Book Cover
PHP 7 Data Structures and Algorithms
$ 35.99
$ 10.00
Domain-Driven Design in PHP Book Cover
Domain-Driven Design in PHP
$ 39.99
$ 10.00
PHP 7: Real World Application Development Book Cover
PHP 7: Real World Application Development
$ 69.99
$ 10.00
Building RESTful Web Services with PHP 7 Book Cover
Building RESTful Web Services with PHP 7
$ 35.99
$ 10.00
Modernizing Legacy Applications in PHP Book Cover
Modernizing Legacy Applications in PHP
$ 35.99
$ 10.00