Get your next remote job on LaraJobs.
1 contributor Edit on GitHub Laravel

Laravel interview questions and answers for 2023

Table of contents:

Laravel interview questions and answers for 2023


I’ve been in countless job interviews over the last decade as a candidate and occasionally as a recruiter too.

You will be fine if:

  • You are curious about the company.
  • You are knowledgeable enough on Laravel to answer common interview questions.
  • You have a good attitude (meaning that you’re not a know-it-all developer, unable to handle constructive criticism).

Depending on the job offer, there may be hundreds of other developers who applied. But don’t be discouraged if you don’t get it. Apply to as many as possible.

Understand why a company needs you, the developer; This will greatly help during the interview.

A company needs you because they want to keep their product evolving or work on new client projects.

They hire a developer to help them make more money, not to let you mindlessly write code all day.

They will make more money if you understand what a return on investment (ROI) is.

Imagine your employer asks you to work on a new feature. Your job is to build it as quickly as possible. There are a few ways to succeed in this endeavor (in priority order):

  1. Use no-code tools. This is counterintuitive as a developer. But doing this will allow you to spend your energy building things that can’t be outsourced to an existing product.
  2. Use open-source libraries. Those will help you deliver faster and better than if you tried to do everything yourself. Libraries are maintained by an army of developers and used by thousands.

Understand that any business is looking for minimal efforts for maximum profits. Don’t think your employer is some sandbox you can experiment in.

Laravel interview questions and answers for 3, 5, 10 or more years of experience

What is the latest version of PHP?

Answer: When writing this article, the latest version of PHP is 8.2. I even wrote about PHP 8.3 already!

Knowing the latest PHP version before applying for a PHP job is mandatory.

You wouldn’t hire a developer who doesn’t have such basic knowledge. This would be a testimony to a cruel lack of curiosity. 😬

PHP 8.2

What is Composer?

Answer: Composer is a dependency manager for PHP.

This is the way to go if you need to use third-party code.

Composer wasn’t always there. It appeared in 2012 and completely changed how we develop apps in PHP.

Interview Question: What is Composer?

What is the latest version of Laravel?

Answer: At the time I’m writing this article, Laravel 10 is the latest version.

In February 2024, Laravel 11 will be released. If I don’t update this article in time, please consider this.

We both know how important it is to know the latest version of Laravel is… in a Laravel interview. 😅

This question might sound stupid, but it’s a quick gauge of an developer’s curiosity.

What is a Service Provider in Laravel? And what about the Container?

Answer: A Service Provider is a class responsible for registering services in the container. The AppServiceProvider class for instance.

The container, in simple terms, is like a magic box in which you store your services that can retrieve and conveniently serve you whatever you need.

Let’s say we have a Client class (aka service) that posts tweets on Twitter.

We can register it like so in app/Providers/AppServiceProvider.php:

use App\Twitter\Client;
class AppServiceProvider extends ServiceProvider
public function register() : void
$this->app->bind(Client::class, function () {
return new Client(config('services.twitter.client_id'));

Then, in app/Http/Controllers/PostController.php, and a lot of places in your codebase, you can get the instance of Client registered in the container by type hinting your controller method:

use App\Twitter\Client;
class PostController extends Controller
public function store(StorePostRequest $request, Client $client) : View
// Create the post.
// Tweet about it.
// Redirect the user.

Learn more about Laravel’s container.

What is a Facade in Laravel?

Answer: A Facade is a proxy to a dependency registered in the container.

Unlike true static methods, they provide a static interface without reducing testability. They also facilitate dependency swapping at run time.

Facades have a bad reputation because people think you perform a real static call. But they’re not. Here’s a representation of what happens that I stole in one of my tweets:

You → Facade::foo() → Laravel → __callStatic() → Container → $dependency→foo()

  1. You call Facade::foo();
  2. Laravel intercepts the call to the foo() method using the magic method __callStatic() (here’s magic methods documentation).
  3. It pulls from the container the corresponding dependency (which is defined in a Facade’s getFacadeAccessor() method).
  4. Then, the framework basically translates Facade::foo() to app('some-dependency')->foo().

This is why unlike true static calls, Facades don’t make testing harder. It’s actually the opposite.

What is Lumen?

Answer: Lumen is a microframework created at a time PHP still needed extra help to perform. It’s a lightweight version of Laravel mostly used for web API development.

Today, PHP and Laravel are fast enough for APIs when coupled to good configuration and with Octane.

This is why the Laravel team discourages people from using Lumen, as it isn’t actively maintained anymore.

What are automated tests?

Answer: Automated tests are tests that are executed by software, rather than manually performed by a human.

These tests are written as code and can be run automatically as often as needed.

They can be integrated into a continuous integration/continuous deployment (CI/CD) pipeline to be executed every time code is changed or deployed.

The goal is to quickly identify issues, regressions, or inconsistencies in the software being tested without the need for human intervention.

What’s the different between Feature and Unit Tests?

Answer: Feature tests and Unit tests in Laravel serve different purposes and operate at distinct levels of granularity.

Unit tests focus on isolated pieces of code, usually individual methods or functions within a class, to ensure they return expected outputs for given inputs.

They do not interact with the database, other classes, or any external services, making them fast but limited in scope.

Feature tests, on the other hand, simulate real user behavior by making HTTP requests to the application and examining the output. They test the interaction of multiple units of code, often involving database queries, middleware, and even third-party services.

Feature Tests are slower but more effective in catching integration issues between different parts of your application.

Requirements beyond Laravel to nail your interviews

Work on your communication; it’s useful both for the interview and the job.

Expressing yourself clearly, orally and in writing, in your native language, is crucial for being taken seriously.

Your first words with your potential future employer will set the tone of your relationship. It would help if you made a good impression.

If you get the job, you’ll have to communicate with other developers, convey ideas in the most effective way possible, write comments in your code, documentation, etc.

My recommendation is to work on your communication abilities constantly. Listen to smart people talking and learn from them. Use tools to improve your writing, like your device’s autocorrect or Grammarly (which is free to use), and learn from them as well.

Set up a GitHub profile and show it during the interview

I clearly stated in this article how important hiring developers with up-to-date knowledge is.

GitHub is a fantastic tool used by everyone. It’s a hub that hosts Git repositories. You should know about it.

Open-source projects host and share their code on it for free, and many companies do the same privately.

  1. Set up your GitHub account;
  2. Learn how to use Git. Being able to do simple commits, switch branches, and push code to a remote repository (hence the need for GitHub) will make a difference;
  3. Make small contributions to open-source projects or showcase some of your code on your profile.
  4. Include it on your resume!

Take a look at the “Git Me Some Version Control” course on Laracasts.


Set up a LinkedIn profile and use it as a resume to be sent before your interviews

LinkedIn is an excellent platform for looking for a programming job. Even with little experience, recruiters will spontaneously contact you.

LinkedIn lets you add your work experience and other information about you, which anyone can see. You can even generate a PDF version of your profile, which some recruiters will request.

It also lists the latest job offers for developers. You can apply to most of them from LinkedIn, which is convenient.

Be prepared to answer any interview question; keep your skills sharp

The world of programming is constantly changing and this article can’t possibly cover every interview question ever.

Laravel evolves fast, and new tools show up all the time.

As a developer, you must constantly learn and adapt to stay on top of the latest trends. If you do that, you can tackle Laravel expert interview questions easily.

It’s challenging but rewarding, and the constant changes mean you won’t have time to be bored.


Do your best to be ready for your interview.

There’s no shortcut to being hired as a developer.


  • Make sure to be as informed as possible about the company you’re applying to.
  • Show your eagerness to learn.
  • Have a good attitude.
Benjamin Crozat

Written by Benjamin Crozat

Indie hacker, blogger, and AI enthusiast building things with the TALL stack. 🔥

Follow me on:

Recommended articles

9 testing best practices for Laravel in 2023 9 testing best practices for Laravel in 2023

Are you familiar with testing? Good. Here are a bunch of best practices to help you level up even more!

Modified on Oct 27, 2023

20+ Laravel best practices, tips and tricks to use in 2023 20+ Laravel best practices, tips and tricks to use in 2023

Learning a framework can be overwhelming, but time and execution will make you a master. Here are some best practices to help you toward your goal.

Modified on Oct 17, 2023

12 Laravel security best practices for 2023 12 Laravel security best practices for 2023

Secure your Laravel app: protect sensitive files, keep your packages and Laravel updated, use policies, validate input, and more.

Modified on Sep 5, 2023

3 crucial Laravel architecture best practices for 2023 3 crucial Laravel architecture best practices for 2023

Explore Laravel's default architecture to simplify collaboration, compatibility, and onboarding.

Published on Sep 1, 2023 Audio available

Laravel 10: the upgrade guide from version 9 Laravel 10: the upgrade guide from version 9

I show you how to upgrade your Laravel 9 project to version 10 and help you decide whether the return on investment is worth it.

Modified on Nov 2, 2023

Gold sponsors New

  • Wire Elements
    Beautiful handcrafted Livewire components.
    Check site
Your business here


If you buy from one of my partners below, I will be compensated at no cost to you. These are services I use or used, and 100% stand behind.

  • Scalable and reliable VPS hosting.
    Bonus: $200 of free credits
    Check site
  • The Google Analytics alternative without compromise.
    Free trial: 30 days
    Bonus: $10 off your first invoice
    Check site
  • Flare
    Track PHP and JavaScript errors in one place.
    Free trial: 10 days
    Check site
  • Keep track of your Google rankings.
    Free trial: 7 days
    Promo code: WELCOME30
    Check site
- / -