Sunday 5 April 2020

Laravel interview questions for 4 year experienced

Laravel interview questions for 4 year experienced

Question: What is Server Requirements for Laravel 5.6?
  1. PHP >= 7.1.3
  2. PDO PHP Extension
  3. Ctype PHP Extension
  4. OpenSSL PHP Extension
  5. XML PHP Extension
  6. JSON PHP Extension
  7. Mbstring PHP Extension
  8. Tokenizer PHP Extension

Question: What is Laravel Dusk?
It is expressive, easy-to-use browser automation and testing API.

Question: What is Laravel Echo?
Event broadcasting, evolved. Bring the power of WebSockets to your application without the complexity.

Question: How to Install Laravel via Composer?
composer create-project --prefer-dist laravel/laravel myproject

Question: How to Install any Specific version of Laravel via Composer
composer create-project --prefer-dist laravel/laravel blog "5.4.*" //Install Laravel 5.4 using Composer

Question: What is Lumen?
  1. Lumen is a micro-framework provided by Laravel.
  2. It is developed by creator of Laravel Taylor Otwell.
  3. It is mostly used for creating RESTful API's & microservices.
  4. Lumen is built on top components of Laravel.

Question: How to Install Lumen via Composer?
composer create-project --prefer-dist laravel/lumen myproject

Question: List benefits of using Laravel over other PHP frameworks?
  1. Artisan
  2. Migrations & Seeding
  3. Blade Template Engine
  4. Middleware - HTTP middleware provide a convenient mechanism for filtering HTTP requests
  5. Routing (RESTful routing)
  6. Authentication, Cashier, Scheduler, SSH, Socialite
  7. Security
  8. Unit Testing
  9. Caching

Question: Which Template Engine used by Laravel?
Blade is the simple, yet powerful templating engine provided with Laravel.

Question: How to enable maintenance mode in Laravel?
// Enable maintenance mode
php artisan down

// Disable maintenance mode
php artisan up

Question: What are Closures in Laravel?
A Closure is an anonymous function. Closures are often used as a callback methods and can be used as a parameter in a function.

Question: List out databases that laravel supports?
SQL Server

Question: How To Use Insert Query In Laravel?
class UserController extends Controller
     * Create a new user instance.
     * @param  Request  $request
     * @return Response
    public function store(Request $request)
        $user = new User;
        $user->name = $request->name;
        $user->role = $request->role;

Question: What are the available Router Methods?
Route::get($uri, $callback);
Route::post($uri, $callback);
Route::put($uri, $callback);
Route::patch($uri, $callback);
Route::delete($uri, $callback);
Route::options($uri, $callback);

Question: How To Use Update Query In Laravel?
$result = User::where('id',1)->update(['name'=>'My web technology experts notes']);

Question: How To Use Delete Query In Laravel?
$result = User::where('id',$id)->delete();

Question: What is Response in Laravel?
Following are different type of responses?
  1. View Responses
  2. JSON Responses
  3. File Downloads
  4. File Responses
  5. Response Macros
  6. Redirecting To Named Routes
  7. Redirecting To Controller Actions
  8. Redirecting To External Domains
  9. Redirecting With Flashed Session Data

Question: How to get current environment in Laravel?
$environment = App::environment();

Question: Where do you locate database configuration file?
Migrations are like version control for your database, that's allow 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.

Question: What are laravel 6 features?
  1. Inbuilt CRSF (cross-site request forgery ) Protection.
  2. Inbuilt paginations
  3. Reverse Routing
  4. Query builder
  5. Route caching
  6. Database Migration
  7. IOC (Inverse of Control) .
  8. Job middleware
  9. Lazy collections