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

Installing code quality tools as phar files

Composer is not the only possible way to add code quality tools to your project. In this section, we will show you to add the tools as phar files.

We already came across phar in the previous chapters. It stands for PHP Archive and can be considered a whole PHP project within a single file. Technically, it is a self-executable ZIP archive that contains the source code of the application plus all necessary dependencies as well. The big advantage is that the required code is available immediately after download, so you can instantly use any phar file right away without having to care about Composer or dependencies at all. Furthermore, phar files are supported by all modern PHP versions.

This makes the usage of phar files quite handy, as you can treat them like binaries. Usually, you can download the many PHP tools we introduced to you so far as phar files directly and place them in whatever directory you want. However, there is no unified...