// 54 tips tagged "php"
Before asking Claude to scaffold a new feature, point it at your existing code first — it will match your naming, structure, error handling, and test patterns exactly rather than defaulting to framework boilerplate.
Generate typed, immutable Data Transfer Objects with validation and factory methods for your API endpoints in PHP or TypeScript.
Let Claude write custom PHPStan and Larastan rules that enforce your team's conventions, complete with AST visitor logic and config registration.
Scaffold single-database or database-per-tenant multi-tenancy in Laravel with global scopes, middleware, queue context, and tenant-aware caching.
Generate complete SEO meta tags, OpenGraph properties, and Twitter Card markup for all your pages using a reusable helper Claude builds from your routes.
Let Claude generate battle-tested HTML email templates with inline styles, table layouts, and Outlook-compatible markup that renders correctly everywhere.
Fat controllers are where good architecture goes to die — paste yours into Claude and ask it to extract the business logic into a proper service layer.
Integration tests cover the seams between your code and real dependencies — they're the tests that actually catch production bugs, and Claude writes them fast.
BDD Gherkin feature files document expected behaviour in plain English and drive your test suite — Claude writes them from a user story in seconds.
Soft deletes let you recover accidentally deleted records and maintain audit trails — Claude handles the migration, model changes, and query scoping in one shot.
Install the laravel-best-practices Boost skill to equip your AI agent with 100+ curated Laravel conventions, so it generates idiomatic code by default.
Forgetting to wrap related database writes in a transaction is a classic source of data corruption. Ask Claude to audit your codebase and fix the boundaries.