Book Image

PHP 7 Programming Blueprints

By : Jose Palala, Martin Helmich
Book Image

PHP 7 Programming Blueprints

By: Jose Palala, Martin Helmich

Overview of this book

When it comes to modern web development, performance is everything. The latest version of PHP has been improvised and updated to make it easier to build for performance, improved engine execution, better memory usage, and a new and extended set of tools. If you’re a web developer, what’s not to love? This guide will show you how to make full use of PHP 7 with a range of practical projects that will not only teach you the principles, but also show you how to put them into practice. It will push and extend your skills, helping you to become a more confident and fluent PHP developer. You’ll find out how to build a social newsletter service, a simple blog with a search capability using Elasticsearch, as well as a chat application. We’ll also show you how to create a RESTful web service, a database class to manage a shopping cart on an e-commerce site and how to build an asynchronous microservice architecture. With further guidance on using reactive extensions in PHP, we’re sure that you’ll find everything you need to take full advantage of PHP 7. So dive in now!
Table of Contents (15 chapters)
PHP 7 Programming Blueprints
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface
4
Build a Simple Blog with Search Capability using Elasticsearch

The target architecture


The central service of our Microservice architecture will be the checkout service. This service will offer an API for a checkout process that is common to many e-commerce systems. For each checkout process, we will require the following input data:

  • A cart that can contain an arbitrary number of articles

  • The customer's contact data

The checkout service will then be responsible for executing the actual checkout process, which will involve a number of additional services, each handling a single step or concern of the checkout process:

  1. Our fictional e-commerce venture will handle physical goods (or more abstract goods, of which we can only have a limited quantity in stock). So, for each article in a cart, the checkout service will need to ensure that the desired quantity of said article is actually in stock, and if possible, reduce the available stock by that amount. This will be the responsibility of the inventory service.

  2. After successfully completing a checkout process...