[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

How to clean your PHP code

Read(30429) update time(2022-04-13)

This course refers to the software engineer's principles from Robert C. Martin's Clean Code book and applies to PHP. This is not a style guide. This is a guide to developing readable, reusable, and reconfigurable PHP software. Not all of the principles here must be followed, and few are even universally accepted. Although these are just guidelines, they are all summarized by the Clean Code authors over the years.


This article is inspired by clean-code-javascript

Notes

Although many developers are still using PHP5, the running environment of most of the examples in this article requires PHP 7.1.

Translation instructions

The translation is 100% complete and last updated on 2017-12-25. This article is translated by php-cpm based on the yangweijie version of clean-code-php and synchronizes a large amount of original content.

The original text is updated frequently. My translation method is to compare line by line directly using the text comparison tool. Prioritize ensuring that the text content is up to date, and then gradually improve the translation quality.

If you encounter various problems such as invalid links, outdated content, incorrect use of terminology, and other translation errors during the reading process, you are welcome to actively submit a PR.


Latest chapter


别写重复代码 (DRY) 2020-06-19
类的SOLID原则 SOLID 2020-06-19
2020-06-19
对象和数据结构 2020-06-19
函数 2020-06-19
表达式 2020-06-19
PHP变量 2020-06-18