Laravel
Definition
Laravel is a modern, open-source full-stack web application framework written in Php architectural pattern and emphasizes elegant syntax, developer productivity, and comprehensive tooling for building web applications.
Overview
Created by Taylor Otwell in 2011, Laravel has become the most popular PHP framework. It draws inspiration from Ruby On Rails
- Eloquent relationships: Rich relationship definitions (has one, has many, many to many)
- Middleware: HTTP request filtering and authentication pipeline
- Seeding & Migrations: Database version control and test data generation
- Laravel Mix: Asset compilation (Webpack/Vite integration)
- Laravel Sanctum: API authentication and SPA token management
- Laravel Echo: Real-time event subscription with WebSockets
Architecture
- MVC pattern: Controllers, Views (Blade), Models (Eloquent)
- Service Container: Inversion of Control (IoC) container for dependency injection
- Service Providers: Bootstrapping and registering application services
- Facade pattern: Static-like syntax for accessing IoC container services
Major Versions
| Version | Year | Key Features |
|---|---|---|
| Laravel 4 | 2013 | Composer support, Artisan CLI, Eloquent ORM |
| Laravel 5 | 2015 | Package discovery, Laravel Mix, Nova, Passport |
| Laravel 6 | 2019 | PHP 7.2+, Laravel UI, Octane preview |
| Laravel 7 | 2020 | Laravel UI, temporary redirects, route caching |
| Laravel 8 | 2020 | PHP 8+ support, Laravel Sail, Jetstream, Filament |
| Laravel 9 | 2022 | PHP 8.1+, typed properties, Laravel Breeze |
| Laravel 10 | 2023 | PHP 8.2+, strict types, Laravel Pail |
| Laravel 11 | 2024 | Single index.php entry, PHP 8.2+, new directory structure |
Laravel Ecosystem
| Package | Purpose |
|---|---|
| Laravel Livewire | Full-stack framework without JavaScript |
| Laravel Nova | Admin panel for Laravel applications |
| Laravel Echo | Real-time WebSocket subscriptions |
| Laravel Sanctum | API authentication for SPAs and mobile apps |
| Laravel Fortify | Authentication scaffolding |
| Filament | Admin panel and form builder |
| Inertia.js | SPA development without API boilerplate |
Laravel vs Symfony
Laravel is built on top of Symfony components. Key differences:
- Laravel: Opinionated, batteries-included, rapid development focus
- Symfony: Modular, component-based, enterprise flexibility focus
- Symfony provides the building blocks; Laravel assembles them into a cohesive framework
Licensing
Laravel is released under the MIT License, an OSI-approved permissive open-source license. It is free to use, modify, and distribute for any purpose, including commercial use.
See laravel/framework for details.
Use Cases
- Single-page applications (with Inertia.js)
- E-commerce platforms
- Content management systems
- API backends
- SaaS applications
- Rapid prototyping and MVP development
Related Frameworks
- Symfony | Lightweight PHP framework (simpler than Laravel)
- CakePHP | Another PHP MVC framework with ORM and scaffolding