PHP Reactive Programming
eBook - ePub

PHP Reactive Programming

Martin Sikora

Share book
  1. 364 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

PHP Reactive Programming

Martin Sikora

Book details
Book preview
Table of contents
Citations

About This Book

Leverage the power of Reactive Programming in PHPAbout This Book• Develop an interesting multiplayer browser game written in RxJS and re-implement it using RxPHP• Enhance existing reactive applications by building a CLI tool combining Symfony Console• Implement Gearman and Rabbit MQ for asynchronous communicationWho This Book Is ForThis book 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.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 toolIn DetailReactive 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.Style and approachThis book will teach readers how to build reactive applications in a step-by-step manner. It will also present several examples of reactive applications implemented with different frameworks.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is PHP Reactive Programming an online PDF/ePUB?
Yes, you can access PHP Reactive Programming by Martin Sikora in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming in PHP. We have over one million books available in our catalogue for you to explore.

Information

Year
2017
ISBN
9781786461575
Edition
1

PHP Reactive Programming


PHP Reactive Programming

Copyright Š 2017 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: March 2017
Production reference: 1230317
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78646-287-9
www.packtpub.com

Credits

Author
Martin Sikora
Copy Editor
Safis Editing
Reviewer
Alexandru-Emil Lupu
Project Coordinator
Vaidehi Sawant
Commissioning Editor
Kunal Parikh
Proofreader
Safis Editing
Acquisition Editor
Chaitanya Nair
Indexer
Francy Puthiry
Content Development Editor
Zeeyan Pinheiro
Graphics
Abhinash Sahu
Technical Editor
Vivek Pala
Production Coordinator
Aparna Bhagat

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 StackOverflow. 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. Occasionally, Martin writes articles for https://www.smashingmagazine.com/. You can connect with him on LinkedIn at https://cz.linkedin.com/in/martin-sikora-a63b9a30 or GitHub at https://github.com/martinsik.

About the Reviewer

Alexandru-Emil Lupu has about 10 years of experience in the web development area, during which he has developed a range of skills, from the implementation of e-commerce platforms and presentation sites to writing code for online games. He is one of those developers who is constantly learning new programming languages, and he has no problem understanding Ruby, PHP, Python, JavaScript, and Java code.
He is passionate about programming and computer science. When he was a teenager, he did not own a computer or have an Internet connection and would constantly go to an Internet cafe to read all about his programming problems, then go home and struggle to implement what he read. He gladly recounts those days and likes to believe that he's the same guy he was 10 years ago, but with much more experience. For him, "passion" is the word that describes the challenge he had when he was a youngster willing to learn new stuff, getting home at 2 or 3 AM determined to install Linux just to learn something new-this too when he had a Pentium I at 133 MHz in the Pentium IV at 1800 MHz era!
Alexandru-Emil is learning all the time and likes to stay close to well-trained and passionate people who better motivate him. He also likes teams that work intelligently and are energetic, which is why he joined the eJobs team--to face a challenge.
As a proof of his perseverance, Alexandru-Emil Lupu is a certified Scrum Master who is passionate about Agile Development. His resume also includes 3 years as a Ruby on Rails developer and a CTO at 2Performant Network (2Parale); 4 years at eRepublik.com, an online game, during which he was responsible for a long list of tasks, including feature development, performance optimization, and a Tech Lead for an internal project. He has learned the hard way the necessary skills to fulfill his day-to-day tasks at 2Performant.com and, later, all the experience he's got, he is using at eJobs.ro to face new kinds of challenges.
In his little free time, he develops small personal projects. And if he still has any spare time, he reads some technical or project management books or articles. When he's relaxing, he watches thriller movies and likes playing shooter or strategy games.
He doesn’t talk too much, but he's willing to teach others programming. If you meet him for a coffee, prepare yourself to be entertained, he likes to tell a lot of contextual jokes.
You can connect with him on LinkedIn at https://www.linkedin.com/in/alecslupu and interact with him on http://github.com/alecslupu.

www.PacktPub.com

For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
www.PacktPub.com
https://www.packtpub.com/mapt
Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.

Why subscribe?

  • Fully searchable across every book published by Packt
  • Copy and paste, print, and bookmark content
  • On demand and accessible via a web browser

Customer Feedback

Thanks for purchasing this Packt book. At Packt, quality is at the heart of our editorial process. To help us improve, please leave us an honest review on this book's Amazon page at https://goo.gl/5qqL4V.
If you'd like to join our team of regular reviewers, you can e-mail us at [email protected]. We award our regular reviewers with free eBooks and videos in exchange for their valuable feedback. Help us be relentless in improving our products!

Preface

Reactive programming has gained distinct popularity in recent years. This is partly thanks to JavaScript web frameworks such as Angular2 or React, but also because of the increasing popularity of functional and asynchronous programming in languages that support multiple programming paradigms, such as JavaScript, Java, Python, or PHP.
Nowadays, reactive programming is closely associated with Reactive Extensions (also called ReactiveX or just Rx); the most popular library to leverage reactive programming. Notably, RxJS 5, the JavaScript implementation of Rx, is very likely to be the first encounter with reactive programming for many developers. In this book, we will mostly focus on using the PHP port of Rx, called RxPHP (https://github.com/ReactiveX/RxPHP).
Asynchronous programming is not what PHP developers typically deal with. In fact, it’s kind of an uncharted territory because there aren’t many resources available on this topic in PHP. Since reactive programming goes hand in hand with asynchronous programming, we’ll work a lot with event loops, blocking and non-blocking code, subprocesses, threads, and IPC.
Our primary intention, however, will be learning Reactive Extensions and reactive programming with RxPHP. This book includes both RxPHP 1 and RxPHP 2. All examples are written for RxPHP 1 because the API is almost the same, and at the time of writing this book, RxPHP 2 is still in developmen...

Table of contents