Table of Contents
2. Why This Primer Exists
A quiet place to think clearly about PHP in the age of AI
Modern tools can generate PHP instantly
— entire classes, controllers, services, even full applications.
But the speed of generation has created a new problem:
…we now write code faster than we understand it.
This primer exists to help restore that balance.
It is not here to teach PHP from scratch, and it is not a reference manual.
It is a guide for the human part of the collaboration
— the part that cannot be automated
such as…
- understanding context
seeing how a piece of code fits into the larger system - recognizing structure
noticing patterns, boundaries, and architectural intent - choosing the right abstraction
deciding what belongs where — and what doesn’t - protecting the architecture
keeping the system coherent as it grows - keeping the code humane
readable, predictable, and kind to future maintainers
AI can produce code…
but only a human can decide
whether that code belongs in a project.
Why a primer, and why now?
PHP has evolved quietly but profoundly.
PHP 8+ is not the PHP many developers remember — it is stricter, more expressive, more predictable, and far more architectural.
At the same time,
AI tools have become capable of generating
PHP that looks correct, even when it contains:
- subtle logical errors
mistakes that hide behind passing tests - or outdated idioms
patterns from older versions of PHP - insecure patterns
especially around input handling and validation - unnecessary complexity
abstractions without purpose - even mismatched abstractions
code that doesn’t fit the domain or the architecture
The result is a strange new landscape:
Developers are now reviewing more code than they write.
This primer exists to help you review that code with clarity and confidence.
Who this primer is for
This guide is written for developers who:
- already know PHP
but want to refresh their mental model - want to refresh their understanding of modern PHP 8+
not just syntax, but the architectural mindset - want to collaborate with AI without surrendering judgment
staying in control of the design - want to maintain architectural integrity in their projects
even when code is generated at high speed - prefer calm, structured explanations over noise and hype
learning without overwhelm
If you’ve ever looked at AI‑generated code and thought:
“This works… but is it right?”
— then this primer is for you.
What you will learn
This primer gives you the mental model needed to:
- understand how PHP “thinks”
the execution model, the type system, the runtime - recognize modern patterns and idioms
the shapes of contemporary PHP - evaluate AI‑generated code with intention
seeing what belongs and what doesn’t - spot risks, outdated practices, and hidden complexity
the things AI often gets subtly wrong - guide AI toward safer, clearer, more maintainable solutions
shaping the context so the model produces better code
It is not about memorizing syntax.
It is about seeing the shape of the code.
How to use this primer
You can read it linearly, or you can jump directly to the topics you need:
- The PHP Mental Model — how PHP executes and why it matters
- Modern PHP Essentials — the features you must recognize at a glance
- Security Fundamentals — the mistakes AI often makes
- Working with AI Effectively — how to ask for better code
- Common Patterns AI Uses — the structures AI tends to generate
Each section is short, intentional, and focused on understanding rather than memorization.
The purpose behind the project
This primer is part of a broader effort to document a calm, modern approach to PHP development
— one that respects both the language and the human judgment required to use it well.
It is written and maintained by
Tony de Araujo,
and shaped by the belief that:
- AI can accelerate us,
but
only clarity can guide us
Our job is to engineer the context; the AI’s job is to generate possibilities.
- Next: The PHP Mental Model
