PHP interviews cover language semantics, OOP, Laravel or Symfony, MySQL, and web security basics. Below are the most common questions with model answers. Senior: architecture, trade-offs, mentoring, and decision-making.
Try it — no account needed
Preparing your question…
Topics to prepare
✓OOP and SOLID in PHP
✓Laravel / Symfony
✓MySQL and query optimization
✓Composer and autoloading
✓Sessions, cookies, security
✓PSR standards
6 Senior-level questions with answers
1
Where should business logic live in a Laravel application?
Answer
Not in the controller and not in the model, because the first makes it unreachable from a command and the second makes the model a place everything accumulates. Service or action classes with a single responsibility, taking what they need and returning a result, stay testable and callable from a controller, a job or a console command alike.
2
How do you make a deploy zero-downtime with a schema change?
Answer
In stages that each work with the running code: add a nullable column, deploy code that writes both, backfill in chunks, switch reads, then remove the old column in a later release. The specific PHP trap is opcache — a deploy that swaps files under a running process can serve a mix of old and new until it is cleared.
3
How do you find why a PHP application got slow?
Answer
A profiler over a real request rather than a guess — Xdebug or Blackfire will name the function, and the answer is usually query count rather than PHP itself. Then check the obvious infrastructure: opcache enabled in production, and whether the framework is booting more service providers than the request needs.
4
What do you cache, where, and how do you invalidate it?
Answer
Cache the expensive and stable: a computed report, a config tree, a query whose result changes rarely. Tag it so a related write can clear a group rather than the whole store. Time-based expiry is wrong but self-healing, and for most read-heavy data it beats explicit invalidation you will eventually forget to call.
5
How do you keep a long-lived PHP codebase upgradable?
Answer
By staying close to the framework rather than wrapping it in your own abstractions, since every wrapper is something you maintain across their upgrades. Then: a dependency policy, static analysis at a level you actually enforce, and upgrading one minor version at a time so the jump is never a project. A codebase two majors behind is one nobody wants to touch.
6
When would you not use a framework?
Answer
For a small service with one job, where the boot cost and the dependency surface buy nothing — a few files and a router are honest. The moment you need auth, migrations, queues and a permission model, writing them yourself costs more than learning someone else's. The decision to be wary of is a framework chosen for a service that will never grow into it.
🦎
Reading answers is not enough
In a real interview you speak under pressure. Cam asks these same questions, scores every answer, and shows exactly what to fix.