55 Laravel interview questions with answers
55 Laravel interview questions with detailed answers, sorted from basic to advanced. Free to practice, with progress saved automatically.
All Laravel interview questions
What is Laravel and what problems does it solve?
What is routing in Laravel and how do you define routes?
What is the Blade templating engine?
What are Laravel migrations and how do you use them?
What is the MVC pattern and how does Laravel use it?
What is Artisan and what are some common commands?
What are Laravel controllers and what do they do?
What is dependency injection in Laravel?
What is a service provider in Laravel?
What are Laravel validation rules and how do you validate form data?
What is Eloquent ORM and why is it better than raw SQL?
What are Laravel models and how do you create them?
What are Eloquent relationships and what types exist?
What is the N+1 query problem and how do you fix it?
What are query scopes in Laravel?
What are accessors and mutators in Eloquent?
What is soft delete in Laravel?
What are database factories and seeders in Laravel?
What is a query builder in Laravel and what are its advantages?
What is the Laravel service container and how does it work?
What are Laravel events and how do you use them?
What are Laravel queues and why use them?
What is middleware in Laravel and how do you create custom middleware?
What is broadcasting in Laravel and when do you use it?
What are Laravel policies and how do you authorize actions?
What is Laravel testing and what are the main testing types?
What is the Laravel facade pattern?
What are Laravel collections and how do you use them?
What is Laravel Reverb and how does it differ from Pusher?
What is Laravel Pennant and how does it enable feature flag management?
What is Pest and why should new Laravel projects use it over PHPUnit?
What is the difference between Sanctum and Passport for API authentication?
What are API Resources in Laravel and why not return raw model data?
What are DTOs (Data Transfer Objects) and how do they improve code architecture?
What is architecture testing in Laravel with Pest and why is it important?
What is the difference between feature tests and unit tests in Laravel?
What is Livewire 3 and how does it change Laravel full-stack development?
What is CSRF and how do you prevent it (including Laravel’s `@csrf`)?
What is the Repository pattern in Laravel/PHP?
How does caching work in Laravel (stores, tags)?
What is task scheduling in Laravel?
How do file upload and storage work in Laravel?
How do `register()` and `boot()` differ in a service provider? What breaks if you mix them up?
What is a Form Request? Why prefer it over calling `$request->validate()` inside the controller?
How do `bind`, `singleton`, `scoped`, and `instance` differ in the service container? When do you use each?
How does route model binding work? How do you bind by `slug` and avoid exposing another user's data?
What is a polymorphic relationship in Eloquent? When do you use it and what are its downsides?
How does `hasManyThrough` differ from `belongsToMany`? Give a practical example.
When do you use built-in casts, `Attribute` accessors, and custom casts in Eloquent? How do they differ?
How does Laravel handle a failing queue job? How do `tries`, `backoff`, `retryUntil`, and `failed()` work?
How does an Observer differ from Events/Listeners? When do you pick each?
Design a stock-deduction flow when many users order at once: how do you use transactions and locking to avoid overselling?
How do you catch N+1 queries before production? How does `preventLazyLoading` work?
How do you handle duplicate job dispatches (double-clicked buttons, overlapping cron runs)? How does `ShouldBeUnique` differ from `WithoutOverlapping`?
Why does code work locally but `env('API_KEY')` return `null` in production?