The PHP Way of Life

Towards a modern, yet simple PHP
Let’s embrace a PHP that stays true to its roots — lightweight and efficient

Introduction: PHP, the Web's Language

There are good reasons why PHP is the most popular language on the web.

Arrays: The preferred way to transfer data, simple and flexible

PHP arrays are easy to use, highly versatile, and incredibly flexible. They can store any type of data, are simple to manipulate, and efficient to iterate over.

Objects: Perfect for organizing code, best used with procedural logic

Pragmatism should always come first. An 'everything must be an object' approach adds unnecessary complexity and makes code harder to maintain.

Typing: Strong in principle, adaptable in practice, but never strict

Specifying parameter and return types is good, but strict typing makes code unnecessarily complicated.

Web Interfaces: Server-generated HTML is key to a fast, accessible Internet

For user-oriented websites, generate HTML on the server side using a template engine, and add progressive enhancement to improve the interface with minimal Javascript.

Databases: ORMs and NoSQL look like your friends, but SQL truly is

Beware of ORMs: their promise of simplicity often masks unnecessary complexity. Understand how relational databases work, and you'll see that SQL can become your best ally.

Frameworks: Good servants but terrible masters

Let’s reject the dogmatic overuse of needlessly large and complex frameworks.

Automated tests: Unit, integration, functional − Find your balance

Automated tests are your best defense against regressions. But 100% unit test coverage may be expensive… and still far from enough.

Micro-services: Highly unlikely you’ll need them

Except for very large teams, a monolithic application will always be faster to develop, easier to debug, more performant, and less expensive.

APIs: Challenge the habits

Webhooks over APIs, RPC over REST, HTTP Basic over JWT… Embrace simplicity over trends, pragmatism over fashion.

Security: The Non-Negotiable Basics

Security practices take discipline, but some are easier than you think.

The Manifesto

Click here to read the full PHP Way of Life Manifesto.

Also available in other formats: