What Laravel Does
- Routing — expressive route definitions
- Eloquent ORM — ActiveRecord pattern, relationships, scopes
- Blade templates — lightweight, compiled template engine
- Artisan CLI — code generation, migrations, tinker REPL
- Queues — Redis, SQS, database queue drivers
- Events and broadcasting — event-driven + WebSocket (Reverb)
- Auth — sessions, API tokens (Sanctum), OAuth (Passport)
- Livewire — reactive frontend components in PHP
- Testing — PHPUnit + Pest integration
- Inertia.js — SPA without building an API
Architecture
MVC: Models (Eloquent), Views (Blade), Controllers. Service container provides IoC/DI. Facades wrap services for static-like syntax. Middleware pipeline for request/response processing. SOLID principles and PSR standards throughout.
Self-Hosting
# Production on Linux + Nginx
composer install --optimize-autoloader --no-dev
php artisan config:cache
php artisan route:cache
php artisan view:cacheOr use Laravel Forge (automated server provisioning) or Vapor (serverless on AWS Lambda).
Key Features
- Eloquent ORM
- Blade templates
- Artisan CLI
- Queue system
- Broadcasting (Reverb WebSocket)
- Sanctum API auth
- Livewire for reactive UI
- Inertia.js for modern SPAs
- Pest testing framework
- Laravel Forge and Vapor ecosystem
Comparison
| Framework | Language | Style | Ecosystem |
|---|---|---|---|
| Laravel | PHP | Elegant, batteries | Largest PHP |
| Symfony | PHP | Components, enterprise | Large |
| Django | Python | Batteries-included | Large |
| Rails | Ruby | Convention > config | Large |
| NestJS | TypeScript | Angular-inspired | Large |
| Spring Boot | Java | Enterprise | Largest Java |
常见问题 FAQ
Q: Laravel vs Symfony? A: Laravel 更 opinionated、开发速度快、DX 好;Symfony 更 modular、企业级、可重用组件(实际上 Laravel 底层用了很多 Symfony 组件)。
Q: Livewire 替代 React? A: 对中等交互性的应用可以。Livewire 用 PHP 写响应式 UI,省去前后端分离。超复杂交互仍然建议 React/Vue + Inertia。
Q: 性能问题? A: PHP 8.3 + OPcache + Route/Config cache + Octane (Swoole/Franken) 后性能不输 Node.js。
来源与致谢 Sources
- Docs: https://laravel.com/docs
- GitHub: https://github.com/laravel/laravel
- License: MIT