/// Resources
Articles, tools, and talks from the Lamp team.
We also contribute to the wider development community. Everything here reflects the same priorities we bring to client work: code quality, testing, static analysis, and building systems that last.
/// Articles
Your Pull Requests Already Know How Your Project Is Going
Pull request data is just numbers, states and dates, but it says a lot about how work flows through a team. This article covers what to look for, the patterns that matter, and a free tool at pr.lampbristol.com that charts it all from a GitHub repository or a CSV.
Read the article →PHP Has Had Generics for Years. You're Probably Just Not Using Them.
Generics are near the top of most PHP developers' wish lists. But you can have almost all the benefits today, with no RFC and no waiting for PHP 9. You just need a static analyser and a few docblock annotations.
Read the article →Rector Isn't Just for Upgrades. Most Teams Are Using a Tenth of It.
Most teams run Rector once every year or two, when it's time to upgrade. It can also make one-off refactors across a whole codebase in seconds, check your coding standards on every pull request, and add temporary instrumentation to find dead code. This article covers each use, with a custom rule written step by step.
Read the article →Stop Writing Coding Standards Documents. Write PHPStan Rules Instead.
Most coding standards documents are out of date or ignored, and none of them stop a bad line of code reaching the main branch. This article shows how to turn those standards into custom PHPStan rules. Once you've written a couple, a useful rule takes 5 to 10 minutes.
Read the article →If One Small Change Breaks Half Your Tests, Your Tests Are the Problem
A small change shouldn't break two hundred tests. When it does, the problem isn't the change, it's that the tests are tightly coupled to the code they test. Three stories from a real-ish project show how to fix that.
Read the article →PHP's RFC Process Takes Years. You Can Add Language Features This Afternoon.
Getting a new feature into PHP means an RFC, a vote and a wait for the next release, often years. But features that express intent, like C++'s friend or Java's package-level visibility, can be added today using PHP attributes and static analysis.
Read the article →We Upgraded Laravel 4.2 to Laravel 9. The Diff Deleted More Code Than It Added.
A real production application, five major versions of Laravel and a big jump in PHP. This covers what made the upgrade possible, from tombstones that find dead code to custom Rector rules for the repetitive changes, and the biggest mistake we made along the way.
Read the article →Can a New Starter Release Code on Their First Day?
It's the standard we hold our systems to, and one of our subcontractors met it on their first day with us. If a newcomer can understand the code, make a change and release it safely on day one, almost everything else about the system is working. This covers what that proves, and what it takes.
Read the article →You've Just Run PHPStan on Your Legacy Codebase. Don't Fix the Errors.
Run PHPStan at max level on a codebase that's never used it and you'll get thousands of errors. Rather than fixing them all or turning the level down, draw a line in the sand: baseline the existing issues and only fail the build on new ones. This covers the three ways to baseline, making it stick in CI, and paying down the backlog.
Read the article →Code Review Won't Find Many Bugs. Do It Anyway.
If you sell code review to your manager as a way to catch bugs, it will look like it isn't working. Most of what review finds is the stuff that makes code harder to change, and that's the expensive part. How to review, what to look for, and how to make your own code easy to review.
Read the article →Your Tests Pass. You Have 100% Coverage. Your Code Is Still Broken.
A function with 100% line and branch coverage can still be broken, and PHPStan finds the bug in about a second. Tests and static analysis do different jobs, and you need both. This covers the kinds of problem the analyser finds, how to help it understand your code, and how to make hidden coupling visible.
Read the article →Your Types Are Correct. Your Code Is Still Wrong.
Pass a postal address to a method that expects an email address, and PHP, your IDE and PHPStan won't complain. The problem isn't a missing type. It's that string is too weak a type to say what the value actually is.
Read the article →/// Open source
Tools we wrote and still maintain. Across all our packages, they've been downloaded 3.5 million+ times.
SARB
1.7 million+ downloadsStatic Analysis Results Baseliner. Adopt static analysis on an existing project without the wall of existing warnings. Only new issues are reported. Language-agnostic.
GitHub →PHP Language Extensions
600k+ downloadsAttributes that add new language features to PHP, such as #[Friend] and #[NamespaceVisibility], enforced by static analysis. Used in production codebases including our own.
GitHub →PHPStan PHP Language Extensions
500k+ downloadsThe PHPStan rules that enforce PHP Language Extensions' attributes, such as #[Friend] and #[NamespaceVisibility], so misuse is reported before the code runs.
GitHub →Test Splitter
600k+ downloadsSplits PHPUnit test suites into batches for parallel execution, reducing CI pipeline time.
GitHub →PHPStan Rule Test Helper
70k+ downloadsMakes it easier to write tests for custom PHPStan rules. We cover this in our workshops.
GitHub →PHPStan Effect System
Mark the methods that are slow, do I/O or hit the database. PHPStan traces every call path and reports code marked #[EffectFree] that still reaches one, such as a controller making an HTTP call three layers down. Experimental.
GitHub →/// Conference talks on the topics we cover in Train workshops
Every talk and workshop, with slides: the full speaking diary on daveliddament.co.uk →
/// Community
PHP-SW, Bristol's PHP meetup
Lamp Bristol proudly sponsors PHP South West.
A community of over 1,000 developers that gets together on the second Wednesday of every month. One or two talks on what actually matters in real projects: testing, frameworks, debugging, scaling. Then pizza, beer, and the conversations that never make it onto the slides. First-time speakers are as welcome as seasoned ones.
Meetup →