Mastering PHP 7
538 pages
English
PDF
4.5

Mastering PHP 7

Mastering PHP 7

Author:

Year:

Summary:

Introduction

The book «Mastering PHP 7» by Branko Ajzele was published in 2017 and immediately took a worthy place among the literature on modern PHP. This is not another introduction to syntax, but a full-fledged guide for those who are already familiar with the basics and want to raise their skills to a professional level. Volume — 538 pages, published by Packt Publishing. The book is aimed at PHP developers striving to write clean, maintainable, and scalable code.

What the book is about

The author consistently guides the reader from environment setup to advanced topics: asynchronous programming, working with databases, testing, security, and deployment. Each chapter contains practical examples and ready-to-use patterns. Special attention is paid to the innovations of PHP 7: scalar types, return types, anonymous classes, generators, and improved error handling through exceptions.

Who this book is for

The book is intended for developers who already have experience with PHP (at least 1–2 years) and want to systematize their knowledge. Beginners will find it difficult due to the fast pace and abundance of technical details. It is ideal for those transitioning from PHP 5 to PHP 7 or preparing for an interview for a Middle/Senior position.

What the reader will learn

  • Modern coding standards — PSR-1, PSR-2, PSR-4, and working with Composer.
  • OOP in PHP 7 — traits, interfaces, abstract classes, late static binding.
  • Typing — strict and weak types, type declarations for arguments and return values.
  • Error handling — exceptions, Error classes, custom handlers.
  • Working with databases — PDO, migrations, query builders.
  • Testing — PHPUnit, mock objects, TDD and BDD approaches.
  • Security — XSS, CSRF, SQL injections, password hashing.
  • Asynchrony — generators, coroutines, ReactPHP.
  • Architecture — SOLID, Dependency Injection, Service Locator, MVC.
  • Tools — Xdebug, PHP CodeSniffer, PHPStan, Docker for development.

Strengths

The main advantage of the book is its practical focus. Each chapter ends with exercises and links to a repository with examples. The author not only explains the theory but also shows how to apply it in real projects. The chapter on performance deserves special mention: profiling, caching (OPcache, APCu), query optimization. The book is written in a lively language, complex concepts are illustrated with clear diagrams and code listings.

Who is recommended

I recommend the book to everyone who wants to stop writing "spaghetti code" and master professional practices. It will be useful for both freelancers and employees of IT companies. If you have already read Matt Zandstra's "PHP Objects, Patterns, and Practice," then "Mastering PHP 7" will be an excellent next step. The only downside is that the book has not been updated for PHP 8, but 90% of the material remains relevant today.

Recommendations