Book Image

Clean Code in PHP

By : Carsten Windler, Alexandre Daubois
5 (1)
Book Image

Clean Code in PHP

5 (1)
By: Carsten Windler, Alexandre Daubois

Overview of this book

PHP is a beginner-friendly language, but also one that is rife with complaints of bad code,;yet no clean code books are specific to PHP. Enter Clean Code in PHP. This book is a one-stop guide to learning the theory and best practices of clean code specific to real-world PHP app development environments. This PHP book is cleanly split to help you navigate through coding practices and theories to understand and adopt the nuances of the clean code paradigm. In addition to covering best practices, tooling for code quality, and PHP design patterns, this book also presents tips and techniques for working on large-scale PHP apps with a team and writing effective documentation for your PHP projects. By the end of this book, you’ll be able to write human-friendly PHP code, which will fuel your PHP career growth and set you apart from the competition.
Table of Contents (18 chapters)
1
Part 1 – Introducing Clean Code
8
Part 2 – Maintaining Code Quality

Code reviews

The process of manually checking the code of other developers is called a code review. This includes all changes, that is, not only new functionality but also bug fixes or even simple configuration changes.

A review is always done by at least one fellow developer, and it usually happens in the context of a pull request, shortly before the code of a feature or bug fix branch gets merged into the main branch; only if the reviewer approves the changes will they become part of the actual application.

In this section, we will discuss what you should look for in code reviews, why they are so important, and how they should be done to make them a successful tool in your toolkit.

Why you should do code reviews

It might sound a bit obvious because that is what this whole book is about. Yet, it cannot be stressed enough – code reviews will improve the quality of your code. Let us examine more closely why:

  • Easy to introduce: Introducing code reviews usually...