Full Transcript

Laravel 11.x Laravel 11.x Offline Documentation Last updated on: Tue Sep 17 2024 Created & maintained by — Mohammad Nurul Islam (Shihan) Page 1 of 1512 Laravel 11.x Why PDF ver...

Laravel 11.x Laravel 11.x Offline Documentation Last updated on: Tue Sep 17 2024 Created & maintained by — Mohammad Nurul Islam (Shihan) Page 1 of 1512 Laravel 11.x Why PDF version? Preface As a full stack web (and backend service) developer, I often need to create api & admin interface for small to medium web applications in shortest possible time. And due the expressive syntax & the rapid development tools provided, I find Laravel to be very useful for this purpose. Also for myself, I sometimes intensionally turn off internet while writing code to focus on work to meet deadline. During that isolated time, I need offline versions of documentation of various tools, libraries and framework. Even though, for most of the other tools, libraries & frameworks offline documentation is available, for Laravel it was never true. To solve this issue, few years back I created & maintained offline downloadable documentation of all Laravel versions available then and published via Leanpub as free (with 0.0 minimum price) for others, with scripted processing on the markdown files from the Laravel documentation repo available in github. But, unfortunately with some successive policy changes by Leanpub authority for the authors, it was becoming impossible for me to maintain already published versions or create new books for new versions of Laravel. Also, due to professional requirement, I had to switch to various other technologies and didn't had to work with Laravel for a few years. So, I eventually give up maintaining those Leanpub publications of Offline Documentation of Laravel. Recently I got back to Laravel for some new projects and missed the Offline Documentation again, while getting myself up to date with new features available in new versions of Laravel. So, this time, instead of depending on third party publishing platforms, I developed a new tool myself for automating the required processing and creation of PDFs from various branches of the documentation repo. This file is result of one such conversion. In laravel-docs-in-pdf repo, you can always find up-to-date You can also watch the repo PDF files corresponding to documentation for each version of and/or follow me on Github, tip Laravel and download copies for offline use. If you find these Twitter or Linkedin, to get PDF documentation files useful and want to show some notification about future support, please give the repo a star and share with your releases of the PDF version of social/professional network. Laravel documentation. Any kind of appreciation from the community will encourage & motivate me to continue maintaining this project regularly. To show your generous support, you can of course License & copyright All the PDF files available in laravel-docs-in-pdf repo are licensed under The Unlicense license and available in public domain. Feel free to copy, modify, distribute or whatever you want to do with these files. But, please be aware that, the documentation content of all the PDF files (beside the cover & preface pages) are not covered with this license and is licensed under the original license of Laravel documentation as defined in the original documentation's repo. Page 2 of 1512 Laravel 11.x Table of Contents Prologue Release Notes Upgrade Guide Contribution Guide Getting Started Installation Configuration Directory Structure Frontend Starter Kits Deployment Architecture Concepts Request Lifecycle Service Container Service Providers Facades The Basics Routing Middleware CSRF Protection Controllers Requests Responses Views Blade Templates Asset Bundling URL Generation Session Validation Error Handling Logging Digging Deeper Artisan Console Broadcasting Cache Collections Concurrency Context Contracts Events File Storage Helpers HTTP Client Localization Page 3 of 1512 Laravel 11.x Mail Notifications Package Development Processes Queues Rate Limiting Strings Task Scheduling Security Authentication Authorization Email Verification Encryption Hashing Password Reset Database Getting Started Query Builder Pagination Migrations Seeding Redis Eloquent ORM Getting Started Relationships Collections Mutators / Casts API Resources Serialization Factories Testing Getting Started HTTP Tests Console Tests Browser Tests Database Mocking Packages Breeze Cashier (Stripe) Cashier (Paddle) Dusk Envoy Fortify Folio Homestead Horizon Page 4 of 1512 Laravel 11.x Jetstream Mix Octane Passport Pennant Pint Precognition Prompts Pulse Reverb Sail Sanctum Scout Socialite Telescope Valet API Documentation Page 5 of 1512 Laravel 11.x Chapter 1 Prologue Page 6 of 1512 Laravel 11.x Release Notes Versioning Scheme Support Policy Laravel 11 Versioning Scheme Laravel and its other first-party packages follow Semantic Versioning. Major framework releases are released every year (~Q1), while minor and patch releases may be released as often as every week. Minor and patch releases should never contain breaking changes. When referencing the Laravel framework or its components from your application or package, you should always use a version constraint such as ^11.0 , since major releases of Laravel do include breaking changes. However, we strive to always ensure you may update to a new major release in one day or less. Named Arguments Named arguments are not covered by Laravel's backwards compatibility guidelines. We may choose to rename function arguments when necessary in order to improve the Laravel codebase. Therefore, using named arguments when calling Laravel methods should be done cautiously and with the understanding that the parameter names may change in the future. Support Policy For all Laravel releases, bug fixes are provided for 18 months and security fixes are provided for 2 years. For all additional libraries, including Lumen, only the latest major release receives bug fixes. In addition, please review the database versions supported by Laravel. Version PHP (*) Release Bug Fixes Until Security Fixes Until 9 8.0 - 8.2 February 8th, 2022 August 8th, 2023 February 6th, 2024 10 8.1 - 8.3 February 14th, 2023 August 6th, 2024 February 4th, 2025 11 8.2 - 8.3 March 12th, 2024 September 3rd, 2025 March 12th, 2026 12 8.2 - 8.3 Q1 2025 Q3, 2026 Q1, 2027 End of life Security fixes only (*) Supported PHP versions Laravel 11 Laravel 11 continues the improvements made in Laravel 10.x by introducing a streamlined application structure, per-second rate limiting, health routing, graceful encryption key rotation, queue testing improvements, Resend mail transport, Prompt validator integration, new Artisan commands, and more. In addition, Laravel Reverb, a first-party, scalable WebSocket server has been introduced to provide robust real-time capabilities to your applications. PHP 8.2 Laravel 11.x requires a minimum PHP version of 8.2. Streamlined Application Structure Page 7 of 1512 Laravel 11.x Laravel's streamlined application structure was developed by Taylor Otwell and Nuno Maduro. Laravel 11 introduces a streamlined application structure for new Laravel applications, without requiring any changes to existing applications. The new application structure is intended to provide a leaner, more modern experience, while retaining many of the concepts that Laravel developers are already familiar with. Below we will discuss the highlights of Laravel's new application structure. The Application Bootstrap File The bootstrap/app.php file has been revitalized as a code-first application configuration file. From this file, you may now customize your application's routing, middleware, service providers, exception handling, and more. This file unifies a variety of high-level application behavior settings that were previously scattered throughout your application's file structure: return Application::configure(basePath: dirname(__DIR__)) ->withRouting( web: __DIR__.'/../routes/web.php', commands: __DIR__.'/../routes/console.php', health: '/up', ) ->withMiddleware(function (Middleware $middleware) { // }) ->withExceptions(function (Exceptions $exceptions) { // })->create(); Service Providers Instead of the default Laravel application structure containing five service providers, Laravel 11 only includes a single AppServiceProvider. The functionality of the previous service providers has been incorporated into the bootstrap/app.php , is handled automatically by the framework, or may be placed in your application's AppServiceProvider. For example, event discovery is now enabled by default, largely eliminating the need for manual registration of events and their listeners. However, if you do need to manually register events, you may simply do so in the AppServiceProvider. Similarly, route model bindings or authorization gates you may have previously registered in the AuthServiceProvider may also be registered in the AppServiceProvider. Opt-in API and Broadcast Routing The api.php and channels.php route files are no longer present by default, as many applications do not require these files. Instead, they may be created using simple Artisan commands: php artisan install:api php artisan install:broadcasting Middleware Previously, new Laravel applications included nine middleware. These middleware performed a variety of tasks such as authenticating requests, trimming input strings, and validating CSRF tokens. In Laravel 11, these middleware have been moved into the framework itself, so that they do not add bulk to your application's structure. New methods for customizing the behavior of these middleware have been added to the framework and may be invoked from your application's bootstrap/app.php file: Page 8 of 1512 Laravel 11.x ->withMiddleware(function (Middleware $middleware) { $middleware->validateCsrfTokens( except: ['stripe/*'] ); $middleware->web(append: [ EnsureUserIsSubscribed::class, ]) }) Since all middleware can be easily customized via your application's bootstrap/app.php , the need for a separate HTTP "kernel" class has been eliminated. Scheduling Using a new Schedule facade, scheduled tasks may now be defined directly in your application's routes/console.php file, eliminating the need for a separate console "kernel" class: use Illuminate\Support\Facades\Schedule; Schedule::command('emails:send')->daily(); Exception Handling Like routing and middleware, exception handling can now be customized from your application's bootstrap/app.php file instead of a separate exception handler class, reducing the overall number of files included in a new Laravel application: ->withExceptions(function (Exceptions $exceptions) { $exceptions->dontReport(MissedFlightException::class); $exceptions->report(function (InvalidOrderException $e) { //... }); }) Base Controller Class The base controller included in new Laravel applications has been simplified. It no longer extends Laravel's internal Controller class, and the AuthorizesRequests and ValidatesRequests traits have been removed, as they may be included in your application's individual controllers if desired:

Use Quizgecko on...
Browser
Browser