Laravel Flashcards
Interview Questions
What is Laravel
Laravel is 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.
What are pros and cons of using Laravel Framework?
Pros of using Laravel Framework
Laravel framework has in-built lightweight blade template engine to speed up compiling task and create layouts with dynamic content easily. Hassles code reusability. Eloquent ORM with PHP active record implementation Built in command line tool “Artisan” for creating a code skeleton , database structure and build their migration
Cons of using laravel Framework
Development process requires you to work with standards and should have real understanding of programming Laravel is new framework and composer is not so strong in compare to npm (for node.js), ruby gems and python pip. Development in laravel is not so fast in compare to ruby on rails. Laravel is lightweight so it has less inbuilt support in compare to django and rails. But this problem can be solved by integrating third party tools, but for large and very custom websites it may be a tedious task
Explain Events in laravel
An event is an action or occurrence recognized by a program that may be handled by the program or code. Laravel events provides a simple observer implementation, that allowing you to subscribe and listen for various events/actions that occur in your application.
All Event classes are generally stored in the app/Events directory, while their listeners are stored in app/Listeners of your application.
Explain validations in laravel?
In programming validations are a handy way to ensure that your data is always in a clean and expected format before it gets into your database. Laravel provides several different ways to validate your application incoming data. By default Laravel’s base controller class uses a ValidatesRequests trait which provides a convenient method to validate all incoming HTTP requests coming from client.You can also validate data in laravel by creating Form Request.
How to install laravel via composer
composer create-project laravel/laravel your-project-name version
What is PHP artisan. List out some artisan commands ?
PHP artisan is the command line interface/tool included with Laravel. It provides a number of helpful commands that can help you while you build your application easily.
List some default packages provided by Laravel 5.6
Cashier Envoy Passport Scout Socialite Horizon
What are named routes in Laravel
Named routing is another amazing feature of Laravel framework. Named routes allow referring to routes when generating redirects or Urls more comfortably.
What is database migration
Migrations are like version control for your database, that’s allow your team to easily modify and share the application’s database schema.
What are service providers
Service Providers are central place where all laravel application is bootstrapped. Your application as well all Laravel core services are also bootstrapped by service providers.
All service providers extend the Illuminate\Support\ServiceProvider class. Most service providers contain a register and a boot method. Within the register method, you should only bind things into the service container. You should never attempt to register any event listeners, routes, or any other piece of functionality within the register method.
Explain Laravel’s service container
One of the most powerful feature of Laravel is its Service Container. It is a powerful tool for resolving class dependencies and performing dependency injection in Laravel. Dependency injection is a fancy phrase that essentially means class dependencies are “injected” into the class via the constructor or, in some cases, “setter” methods.
What is composer
Composer is a tool for managing dependency in PHP. It allows you to declare the libraries on which your project depends on and will manage (install/update) them for you.
Laravel utilizes Composer to manage its dependencies.
What is dependency injection in Laravel
In software engineering, dependency injection is a technique whereby one object supplies the dependencies of another object. A dependency is an object that can be used (a service). An injection is the passing of a dependency to a dependent object (a client) that would use it. The service is made part of the client’s state. Passing the service to the client, rather than allowing a client to build or find the service, is the fundamental requirement of the pattern.
What are Laravel Contracts
Laravel’s Contracts are nothing but a set of interfaces that define the core services provided by the Laravel framework.
Explain Facades in Laravel
Laravel Facades provides a static like an interface to classes that are available in the application’s service container.