The Loop, Not the Tool
AI-Powered PHP Development in Practice • Part 1 of 9 • PHP • AI
I’m deeply, professionally skeptical of anything that promises to change how we write software. Twenty-five years in PHP, I’ve sat through the “this changes everything” talk a dozen times. Most of those things didn’t change anything.
So when I say a new category of tool actually did — and I mean the agentic ones, not autocomplete — I need to open with the failure, because the failure is where the real lesson lives.
The first time an agent confidently rewrote a working regex into a subtly broken one, and then explained — with total conviction — why the new version was “more robust,” was the day I stopped trusting drafts and started trusting harnesses. It wasn’t the wrong answer that got my attention. It was the fluency. The diff read like something I would have written. I caught myself almost not reading it carefully, because it looked right.
That complacency — mine, not the tool’s — is what this series is about.
What These Tools Are Actually Good At
Let’s calibrate before we go further. Current AI coding tools split cleanly into two columns:
| Genuinely good at | Reliably bad at |
|---|---|
| Boilerplate & scaffolding | Your undocumented business rules |
| Pattern-matching common code | Knowing what it doesn’t know |
| Explaining unfamiliar code | Admitting uncertainty |
| First-draft implementations | Novel architectural judgment |
The left column is real value. The right column is where teams get hurt, because the failure modes on the right don’t feel like failures. The output is fluent. It compiles. It looks like the code your senior developer wrote last Tuesday.
And one more thing about these tools: they are emphatically not autocomplete. Autocomplete was 2021. The agentic tools of 2026 read a repository, form a plan, execute multi-file changes, run your test suite, and iterate on failures without you touching the keyboard between steps. That’s a different category of tool, and it deserves different intuitions — specifically, a verification discipline you’d never have bothered with for a completion popup.
The Loop
Here is the entire mental model, and it will carry everything else in this series:
Developer → Context → AI → Verification → Production
↑ |
└───────── feedback loop ──────────────┘
- Context — what the model can know about your codebase that the code itself doesn’t say: architecture decisions and their why, business vocabulary, forbidden patterns.
- Task — what you’re asking for, stated specifically enough that “done” is checkable.
- AI — the draft. Fast, well-read, confident, occasionally wrong in ways that read as completely plausible.
- Verification — tests, static analysis, types, security checks. Mechanical, not eyeballed, not “lgtm.”
- Production — shipping, with a reviewer’s sendback feeding back into context: the thing you caught becomes a line the next run reads. Without that arrow, it isn’t a loop — it’s a sequence you re-run from scratch every time.
Notice what’s missing from that diagram: the name of any product. Which tool you use — Claude, Copilot, Cursor, whatever ships next year — is nearly irrelevant to this loop. Tools turn over every eighteen months. The loop is what people keep.
Most teams get this backwards. They optimize prompts against a codebase with zero context files, argue about which model is smartest, and verify by eye at 5pm on a Friday. The loop says: get the context right first, and the model choice matters much less.
Two Things This Isn’t
Two misconceptions worth naming out loud, because they’re the ones that derail conversations about this subject:
This isn’t “AI replaces junior developers.” What’s actually happening is narrower and more interesting: AI removes a lot of the typing juniors used to be handed, which means they have to build judgment faster, with less time spent on autopilot tasks. That’s a real problem for how we train people, and three hours of workshop doesn’t solve it. But “the AI does it now” was never the accurate description — the accurate description is “the AI does the draft, and someone still has to know what correct looks like.”
This isn’t a greenfield toy. Most PHP developers’ real work is legacy Laravel or legacy plain-PHP maintenance. If anything, the asymmetry is the opposite of what people assume: AI-assisted work on ugly, decade-old code is where these tools earn their keep most, not least — provided you follow the rules of engagement (characterize first, refactor second). That’s Part 6, and it’s the part I care about most, because it’s the actual job.
Verification Is the Whole Game
Everything else in this series — review checklists, characterization tests, CI stages — is one idea wearing different clothes:
AI-generated code is a draft from a very fast, very well-read junior developer who has never once been fired for being confidently wrong.
That junior will be wrong regularly. Not randomly — regularly — in ways that read as completely plausible, because plausible is exactly what they were trained to produce. Your job is not to prevent the errors. Your job is to build the harness that catches them:
- The hallucinated API call? PHPStan catches it before a human blinks.
- The off-by-one in the quota check? A test that asserts the boundary catches it.
- The authorization hole in
show()? Only a dedicated security pass catches it, because it looks exactly like correct code to a review that’s simultaneously checking naming.
Three planted bugs, three different catchers — and notably, no single catcher gets all three. That’s the argument for a layered harness rather than any one silver-bullet check. Static analysis doesn’t find business-rule violations. Tests don’t find authorization gaps you never wrote an assertion for. Review doesn’t find the N+1 you stopped seeing on the fourth file. Mechanical verification isn’t about one tool being smart enough; it’s about overlapping nets, each one boring and cheap.
“Verification” isn’t a phase you’ll bolt on at the end. It’s the part of the loop that makes everything to its left safe to automate. Which is why the next article in this series is about the highest-leverage input to any of it — what the model knows before it starts.
Context Beats Cleverness
One sentence to set up Part 2, because it’s the single highest-leverage idea in the whole subject:
A mediocre prompt against a codebase with a good context file beats a brilliant prompt against a codebase with none.
If you’ve been hunting for prompt-engineering tricks, you’re optimizing the wrong variable. But that deserves its own article — the one that follows.
Whoever Clicks Merge Owns the Bug
There’s a misconception I’ve had to say out loud in every workshop and every team I’ve worked with:
“If the AI wrote it, I’m not responsible for it.”
No. Whoever clicks merge owns the bug. That doesn’t change because a model wrote the diff. It never has. Postmortems don’t accept “the AI wrote it” as a root cause, and they never will.
The tools removed a lot of typing. They did not remove judgment — they compressed the time you have to apply it. The loop is how you do that without pretending the draft deserves your trust by default.
It doesn’t. Earn it mechanically, every commit.
Resources
- Slides (PDF): /talks/ai-powered-php-development-in-practice.pdf — the Longhorn PHP 2026 deck
- Workshop repo: github.com/gunnard/workshop-starter — the multi-tenant Laravel app with three planted bugs
- The series: /writing/ — all nine parts as they publish
Next: Part 2 — Context Beats Cleverness: Writing a CLAUDE.md That Actually Works.
This is Part 1 of a nine-part series adapted from “AI-Powered PHP Development in Practice,” my half-day workshop at Longhorn PHP 2026 (Austin, October 15).