Preface

This book provides a 360-degree overview of what it takes to design and build a performant application with Laravel Octane, why you should, and how to do it. This book also covers the different tools used by Laravel Octane, such as Swoole and RoadRunner, and lists and explains the various features and differentiating elements. But the most important thing is that it will enable you to understand why and when to use Swoole or RoadRunner.

Who this book is for

This book is for those Laravel developers who already know the fundamentals of the framework, such as routing mechanisms, controllers, services, and models. It is meant for those developers who would like to design their applications in a more scalable way and make them more performant.

What this book covers

Chapter 1, Understanding the Laravel Web Application Architecture, is where Laravel Octane introduces new features, but more importantly a new way of thinking about how to design high-performance Laravel applications.

Chapter 2, Configuring the RoadRunner Application Server, shows us a scenario where Laravel Octane is based on the RoadRunner application server. RoadRunner is a very fast and effective application server that is easy to install. Because of its simplicity, it allows the user to approach Laravel Octane easily and straightforwardly.

Chapter 3, Configuring the Swoole Application Server, shows us a scenario where Laravel Octane is based on the Swoole application server. Running Swoole as an application server allows the developer to use some advanced features, such as managing multiple workers and concurrent tasks, bootstrapping the application more efficiently, fast caching, and sharing data among workers. Laravel Octane uses Swoole, so it is important to have clear ideas about the opportunities that arise from using these application servers.

Chapter 4, Building a Laravel Octane Application, teaches us how to build an application with practical examples using features provided by the Swoole application server.

Chapter 5, Reducing Latency and Managing Data with an Asynchronous Approach, teaches us that, once the developer has sped up the bootstrapping of the framework and has removed bottlenecks on the request side, they have to reduce latency in other parts of the application. The chapter introduces useful techniques to reduce latency in executing tasks and managing data.

Chapter 6, Using Queues to Apply the Asynchronous Approach in Your Application, teaches us that in addition to the various tools available with application servers, we can add extra components to our application architecture. One of the main tools to go alongside application servers for greater scalability of a solution is queuing mechanisms. This chapter shows what the benefits are of adding a queuing mechanism to our application.

Chapter 7, Configuring the Laravel Octane Application for the Production Environment, discusses going to production and covers environment-specific configurations, deploying an application to an application server, and fine-tuning the configuration of nginx as a reverse proxy for Swoole.

To get the most out of this book

You will need PHP 8.0 or above installed on your computer. All code examples have been tested using PHP 8.1 on macOS and GNU/Linux.

Software/hardware covered in the book

Operating system requirements

Laravel 9

Windows, macOS, or Linux

PHP 8+

If you don’t want to have PHP installed on your local machine and you are familiar with the Docker setup, you could use the Docker images provided by Laravel Sail. The book explains both local installation and installation via Docker images for the setup of the application servers and the modules (Swoole/OpenSwoole).

If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.

Download the example code files

You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/High-Performance-with-Laravel-Octane. If there’s an update to the code, it will be updated in the GitHub repository.

Download the color images

We also provide a PDF file that has color images of the screenshots and diagrams used in this book. You can download it here: https://packt.link/ZTNyn

Conventions used

There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “From the Symfony world, Laravel includes packages such as Symfony/routing to manage routing, and http-foundation and http-kernel to manage HTTP communication.”

A block of code is set as follows:

        "nyholm/psr7": "^1.5",
        "spiral/roadrunner": "v2.0"

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan octane:start --server=swoole --host=0.0.0.0 --port=80 --watch

Any command-line input or output is written as follows:

npm install --save-dev chokidar

Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: “Once everything is fine, you will see Table created! on your web page. This means that the rows were created in the right way.”

Tips or important notes

Appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, email us at [email protected] and mention the book title in the subject of your message.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata and fill in the form.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Share Your Thoughts

Once you’ve read High-Performance Laravel Development with Octane, we’d love to hear your thoughts! Please click here to go straight to the Amazon review pagefor this book and share your feedback.

Your review is important to us and the tech community and will help us make sure we’re delivering excellent quality content.

Download a free PDF copy of this book

Thanks for purchasing this book!

Do you like to read on the go but are unable to carry your print books everywhere? Is your eBook purchase not compatible with the device of your choice?

Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.

Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application.

The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily

Follow these simple steps to get the benefits:

  1. Scan the QR code or visit the link below

https://packt.link/free-ebook/9781801819404

  1. Submit your proof of purchase
  2. That’s it! We’ll send your free PDF and other benefits to your email directly
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset