Ease of installation
Laravel utilizes Composer to manage its dependencies. Composer itself manages the versions of all its dependencies and whenever you run the composer it always installs the latest available version of its dependencies.So, need not to bother about the verisions everytime.
Artisan is the command-line interface included with Laravel. It provides a number of helpful commands that can assist you while you build your application.
It uses the PHP's built-in development server to serve your application with the help of Artisan command's.This command will start a development server at http://localhost:8000:
Project SEO friendly urls are well-defined in your route files, which are available in the routes folder and are automatically loaded by the framework. There are three files in routes folder
- Routes/web.php - Used for describes routes that are for your web interface.These routes are assigned the web middleware group, which provides features like session state and CSRF protection.
- Routes/api.php - Used for stateless and are assigned the api middleware group.
- Routes/console.php – Used for command-line interface included with Laravel. It delivers a number of useful instructions that can help you while you build your application.
Laravel has in built secure packages as
- Middleware – Middleware provide a useful mechanism for categorizing HTTP requests entering your application. For example, Laravel includes a middleware that verifies the user of your application is authenticated. If the user is not authentic, the middleware will not allow user to login and redirects it to the login screen again.
- CSRF Protection – Laravel makes it easy to guard your application from cross-site request forgery (CSRF) attacks. Cross-site request forgeries are a type of malicious activity whereby unauthorized commands are performed on behalf of an authenticated user.
Laravel makes interacting with databases extremely simple across a variety of database backends using either raw SQL, the fluent query builder, and the Eloquent ORM. Currently, Laravel supports four databases:
- SQL Server
You can define your all business logic in the route files as closures, However the use of controller is always a good method of organising this behavior using Controller classes. Controllers can group related request handling logic into a single class. Controllers are stored in the app/Http/Controllers directory.
Views / Blade Templates
Laravel Blade is the simple and powerful templating engine comes with Laravel. Unlike further general and best PHP templating engines, Blade does not restrict you from using plain PHP code in views. In fact, all Blade views are compiled into plain PHP code and cached until they are modified, meaning Blade adds essentially zero overhead to your application. Blade view files use the .blade.php file extension and are typically found in the resources/views directory.
Errors & Logging
Error and exception handling is included with Laravel. The App\Exceptions\Handler class is where all exceptions generated by application and logged into storage/logs/laravel.log file and display back to the user as per APP_DEBUG variable in .env file. For logging, Laravel use the Monolog library, which provides variety of powerful log handlers. Laravel configures several of these handlers for you, allowing you to choose between a single log file, rotating log files, or writing error information to the system log.
HTTP(Hypertext Transfer Protocol) Request and Response
Laravel has best request and response mechanism.
Request - In Laravel we can get the current HTTP request via dependency injection by calling the Illuminate\Http\Request class on controller method. The incoming request instance will automatically be injected by the service container.
Response - All routes and controllers should return a response to be sent back to the user's browser. Laravel provides several different ways to return responses. The most basic response is simply returning a string from a route or controller. The framework will automatically convert the string into a full HTTP response. We can also define a custom response by macro method on the Response façade.