Laravel slim skeleton has been merged into master
The Laravel 11 Skeleton introduces a series of enhancements and modifications aimed at refining the development experience and empowering developers with increased flexibility and control. In this overview, we delve into key alterations, emphasizing the evolution in environment variables, adjustments to default configurations, and the restructuring of fundamental components such as the HTTP Kernel and console kernel.
Noteworthy changes include the removal of the exception handler, middleware restructuring, and the revamped approach to controllers and user models. Additionally, we explore alterations in service providers, the exclusion of Sanctum by default, and advancements in configuration file management. This comprehensive overview provides a nuanced understanding of the Laravel 11 Skeleton’s architectural changes, facilitating a seamless transition for developers and offering insights into the evolving landscape of Laravel development.
Laravel 11 Skeleton Overview
- Additional environment variables have been incorporated into the .env.example file.
- The default value of the QUEUE_CONNECTION variable has been modified to ‘database’ from ‘sync.’
- The BROADCAST_DRIVER and CACHE_DRIVER environment variables have undergone renaming to BROADCAST_CONNECTION and CACHE_STORE, respectively.
- The HTTP Kernel has been eliminated. Configuration tasks previously performed in this file are now accomplished in the bootstrap/app.php file, encompassing the registration and replacement of middleware.
- The console kernel has been deprecated. Schedules are now defined in the console “routes” file. Commands generated by make:command are automatically loaded, necessitating no explicit registration. Additional command loading paths can be registered in the bootstrap/app.php file.
- The exception handler has been omitted. Configuration of exception handling behavior is now conducted in the bootstrap/app.php file using reportable, renderable, throttle, and other functions. Callbacks received by these functions are subject to type hint inspection for handling specific exceptions.
- The base HTTP controller no longer inherits from any other classes, necessitating the use of the new middleware definition feature. No traits are included by default on the base controller. Authorization can be performed using facades, or traits can be manually added.
- All middleware has been removed. Configuration of middleware behavior is now achieved through static methods on the middleware themselves (refer to framework notes).
- The User model now employs a casts method instead of a property. The HasApiTokens trait is no longer included by default since Sanctum is not installed by default.
- All service providers, with the exception of the AppServiceProvider, have been removed. Policies are auto-discovered, and gates can be registered in AppServiceProvider. Similarly, events can be registered in AppServiceProvider. Routing behavior is now determined and customized in the bootstrap/app.php file.
- The new bootstrap/app.php file allows customization of core framework behavior, including routing, container bindings, middleware, and exception handling.
- Sanctum is no longer installed by default (see install:api).
- Configuration files are not present by default but can be published using the config:publish command. Default values now exist in the framework, and application-level configuration cascades with framework definitions, requiring only customized values in application-level configuration files.
- Migration files have been updated to be evergreen. The password_reset_tokens table migration has been merged into the users table migration file. Similarly, the jobs table migration has been combined into a single migration with the failed_jobs table.
- Echo bootstrapping has been excluded by default and can be reintroduced using the new install:broadcasting command.
- API and channel routes files are not included by default but can be regenerated using install:api and install:broadcasting, respectively.