20 questions · PHP / Laravel Developer

PHP / Laravel Developer Interview Questions

A hiring manager's question bank for PHP and Laravel developers — Eloquent and N+1 queries, queues, middleware, the service container, testing, and security. Built to separate people who can scaffold a CRUD app from people who keep a Laravel codebase fast and clean as it grows.

Laravel makes it easy to build something that works, which is exactly why interviewing for it well takes care. Almost any candidate can generate a controller and a model; the developers worth hiring are the ones who understand what the framework does for them and where its conveniences turn into traps. The classic example is the N+1 query: a candidate who loops over a collection and lazily loads a relationship inside the loop has written code that passes every test and then melts the database in production. So the most valuable signal is whether someone reasons about the queries Eloquent generates, knows when to eager load, and can tell the difference between elegant code and efficient code. Beyond the ORM, you want to confirm they understand the pieces that make a Laravel app maintainable: how the service container resolves dependencies, how middleware shapes the request lifecycle, when to move slow work into a queued job, and how to actually test the result. Security matters too — mass assignment, validation, authorization gates, and not trusting user input are where careless Laravel code leaks. The questions below run from Eloquent and the query layer through the framework internals into queues, testing, and security, roughly in order of how depth reveals itself. Listen for candidates who talk about what query a piece of code runs, who reach for jobs and events to keep controllers thin, and who can explain a tradeoff rather than just naming a feature.

How to use these questions

Choose six to eight questions across two or three categories instead of the whole list. Begin with an Eloquent & Database question — the N+1 discussion alone tells you a lot — then move into Framework Internals and close on a Queues, Testing, or Security topic. Follow every clean answer with "what query does that run?" or "how would you test it?" to see real depth.

Eloquent & the Database

  1. What is the N+1 query problem? Show me how it happens in Eloquent and how you would fix it.
  2. When do you use eager loading versus lazy loading, and how do you detect a query problem in the first place?
  3. Explain the difference between Eloquent relationships like hasMany, belongsTo, and belongsToMany with a real example.
  4. When would you drop down to the query builder or raw SQL instead of Eloquent?
  5. How do migrations and seeders fit into your workflow, and how do you handle a schema change safely in production?
  6. What is the difference between a collection and a query, and why does calling all() then filtering in PHP sometimes hurt?

Framework Internals

  1. What is the service container, and what does dependency injection give you in Laravel?
  2. When would you bind something into the container, and what is the difference between bind and singleton?
  3. Walk me through the request lifecycle and where middleware fits in.
  4. How do service providers work, and when would you create one?
  5. What are events and listeners good for, and when would you avoid them?

Queues, Jobs & Performance

  1. When would you move work into a queued job instead of doing it in the request?
  2. How do you handle a job that fails — retries, backoff, and failed jobs?
  3. How would you find and fix a slow Laravel endpoint?
  4. How does caching fit into a Laravel app, and what would you cache versus not cache?

Testing & Security

  1. How do you decide what to test with a feature test versus a unit test in Laravel?
  2. How does Laravel protect against SQL injection, mass assignment, and CSRF, and where can a developer still get it wrong?
  3. How do you handle validation and authorization, and what is the difference between a gate and a policy?
  4. Tell me about a Laravel bug or performance problem you fixed in production. What was the root cause?
  5. A teammate puts heavy business logic directly in a controller. How do you handle that in review?

Tips for interviewing PHP / Laravel candidates

  • Lead with the N+1 question; how a candidate handles it predicts Laravel competence better than almost anything else.
  • Reward developers who think about the actual SQL a line of Eloquent generates, not just whether it works.
  • Probe queues and jobs; knowing when to defer work signals someone who has run Laravel at scale.
  • Ask how they test; a strong Laravel developer writes feature tests as a habit, not an afterthought.
  • Check security instincts around mass assignment, validation, and authorization — careless code leaks here.

Frequently asked questions

Hiring PHP / Laravel developers? JuggleHire ranks, screens, and schedules candidates for you.

JuggleHire goes beyond simple job posting. Leverage custom forms, powerful screening filters, and automated social media previews to find the perfect fit for your team.