laravel/lumen-framework
Core kernel code for Laravel Lumen, the fast PHP micro-framework. Provides the foundation for routing, database abstraction, queues, caching, and more. For building apps, use the main Lumen repository; docs at lumen.laravel.com.
Lumen is a lightweight micro-framework ideal for high-performance, lightweight APIs—especially where speed and minimal overhead matter. Start by installing via Composer: composer create-project --prefer-dist laravel/lumen myapp. Key entry points: bootstrap/app.php (app bootstrapping, service provider registration) and routes/web.php or routes/api.php (routing). Unlike Laravel, Lumen strips out features like Blade templates, sessions (by default), and many console commands—keeping only essentials like routing, Eloquent (optional), and caching. First use case: building a JSON API with minimal middleware—e.g., quick CRUD endpoints backed by a database using DB or Eloquent (enabled via app->enableEloquent() in bootstrap/app.php).
bootstrap/app.php, explicitly call $app->withFacades(), $app->withEloquent(), or register middleware like $app->middleware([...]).routes/web.php (for web-like apps) or routes/api.php (stateless APIs). Use compact closures or explicit controller references:
$app->get('/users', 'UserController@index'); // or fn() => DB::table('users')->get();
bootstrap/app.php via $app->routeMiddleware([...]) and $app->middleware([...]); route-specific via ->middleware('auth').php artisan make:command, but only register manually in app/Console/Kernel.php (Lumen lacks auto-discovery).Tests\TestCase extending Illuminate\Testing\TestResponse; leverages Laravel’s HTTP testing but without session/blade. Prefer assertJsonStructure() and direct DB assertions.app/Providers/EventServiceProvider or app/Providers/AppServiceProvider must be manually registered in bootstrap/app.php under $app->register(...).$app->withFacades()—but avoid them in Lumen; prefer dependency injection to reduce coupling.validate() method behaves differently than Laravel (e.g., no ValidationException with custom status code by default in older versions—fixed in v9.1.1+). Use Validator::make() manually or upgrade.Kernel::commands([...]) call; auto-scan (Laravel’s commands() call in app/Console/Kernel.php) is not supported.phpunit with --filter for targeted tests. Misconfigured .env (e.g., missing APP_DEBUG=false) often causes confusing error leaks.lumen-framework often requires同步 laravel/framework dependencies—check composer.lock diff for unintentional Laravel upgrades.laravel/passport) but register providers manually.How can I help you explore Laravel packages today?