Web Prepration

Web Concept Tutorials

Interview Questions, Laravel

In this post, I am going to share some important questions for laravel interview. In this post share from basics to advance level questions and answers of laravel, which is mostly asked in interview.

1)  What is Laravel ?

Answer:- Laravel is a free open source “PHP Framework ” based on MVC design pattern. It is created by Taylor Otwell. Laravel provides expressive and elegant syntax that helps in creating a wonderful web application easily and quickly.

2) How to install laravel via composer ?

Answer:-  You can install Laravel via composer by running below command.

3) What is Lumen?

Answer:-  Lumen is PHP micro-framework that built on Laravel’s top components.It is created by Taylor Otwell. It is perfect option for building Laravel based micro-services and fast REST API’s. It’s one of the fastest micro-frameworks available.

4) List some features of laravel 5.0 ?


  • Inbuilt CRSF (cross-site request forgery ) Protection.
  • Authentication Scaffolding
  • Inbuilt paginations
  • Reverse Routing
  • Query builder
  • Route caching
  • Database Migration
  • IOC (Inverse of Control) Container Or service container.
  • Laravel schedular
  • Method Injection

5)  What is PHP artisan. List out some artisan commands ?

Answer:- Laravel provides a number of  helpful commands that can help you while you build your application easily. 

Here are the list of some artisan command:-

  • php artisan list
  • php artisan help
  • php artisan tinker
  • php artisan make
  • php artisan –versian
  • php artisan make model model_name
  • php artisan make controller controller_name
  • php artisan make: console FooCommand

6) Compare Laravel With CodeIgniter?

Answer:- Laravel

    • Laravel is a framework with expressive, elegant syntax
    • Development is enjoyable, creative experience
    • Laravel is built for latest version of PHP
    • It is more object oriented compared to CodeIgniter
    • Laravel community is still small, but it is growing very fast.


    • CodeIgniter is a powerful PHP framework
    • Simple and elegant toolkit to create full-featured web applications.
    • Codeigniter is an older more mature framework
    • It is less object oriented compared to Laravel.
    • Codeigniter community is large.

7) Laravel Support Caching?

Answer:- Yes, Its provide.

8) Types of relationships available in Laravel Eloquent?

Answer:-  Below are types of relationships supported by Laravel Eloquent ORM.

  • One To One
  • One To Many
  • One To Many (Inverse)
  • Many To Many
  • Has Many Through
  • Polymorphic Relations
  • Many To Many Polymorphic Relations

9) What is database migration. How to create migration via artisan ?

Answer:-  Database migrations are like version controls for your database, that’s allow you to easily modify and share the application’s database schema. Migrations are typically paired with Laravel’s schema builder to easily build your application’s database schema.

Use below commands to create migration data via artisan.

10) Explain Facades in Laravel ?

Answer:- Laravel Facades provides static like an interface to classes that are available in the application’s service container. Laravel facades serve as “static proxies” to underlying classes in the service container and provide benefits of a terse, expressive syntax while maintaining more test-ability and flexibility than traditional static methods of classes. All of Laravel’s facades are defined in the Illuminate\Support\Facades namespace. You can easily access a facade like so:

11) How to enable Query log in Laravel ?


12) How to use custom table in Laravel Modal ?



13) List some packages provide by Laravel 5.6 ?


  • Cashier
  • Envoy
  • Passport
  • Scout
  • Socialite
  • Horizon

14) How do you define Middleware?

Answer:- To create middleware using artisan command like 

This command create new file within your app/http/middleware directory

15) Exceptions are handled by which class?

Answer:- All exceptions in laravel are handled by the App/Exceptions/Handler/ class. This class contains two methods report and render.

16) What are blade templates ?

Answer:- Blade is a simple and powerful templating engine provided with laravel. Laravel does not restrict you from using plain php code in view.

17) Where do you locate Route files?

Answer:- All routes are defined in routes file which is located in your app routes directory.

18) How to use custom join Query in Laravel ?


19)  How to implement you own package in Laravel?

Answer:- You can create a package in laravel using the following steps:

  1. Package folder and Name
  2. Composer.json file for the package
  3. Loading package via main composer.json and PSR-4
  4. Creating a service provider
  5. Create a controller for your package
  6. Create routes

20) What is the purpose of using dd() function in laravel ?

Answer:- dd(); Stands for Dump and Die.

dd() is a laravel helper function, which will dump a variables content to the browser and stop further execution.

0 comment on Laravel Interview Questions & Answers

Write a comment

Your email address will not be published. Required fields are marked *