Download the PHP package rapidwebltd/no-post-data-laravel-middleware without Composer
On this page you can find all versions of the php package rapidwebltd/no-post-data-laravel-middleware. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rapidwebltd/no-post-data-laravel-middleware
More information about rapidwebltd/no-post-data-laravel-middleware
Files in rapidwebltd/no-post-data-laravel-middleware
Package no-post-data-laravel-middleware
Short Description Under certain conditions, when posting data from a form, the web server may lose the post data. This commonly happens if a user is uploading a large file beyond the size limits set in the web server's configuration. Laravel does not handle this situation and may end up throwing a somewhat confusing `TokenMismatchException in VerifyCsrfToken` due to CSRF protection. The 'No Post Data Laravel Middleware' handles situations in which a post request has been submitted and contains no post data - a situation which should not occur under normal usage. By default, the middleware will redirect back to the previous page with an error message flashed to the session. This can then be output on your view as you would normally handle validation errors. If needed, you can also modify this default behaviour and allow any code to run when the 'post request with no post data' situation is encountered.
License LGPL-3.0-only
Homepage https://github.com/rapidwebltd/no-post-data-laravel-middleware
Informations about the package no-post-data-laravel-middleware
No Post Data Laravel Middleware
Under certain conditions, when posting data from a form, the web server may lose the post data. This commonly happens if a user is uploading a large file beyond the size limits set in the web server's configuration.
Laravel does not handle this situation and may end up throwing a somewhat confusing TokenMismatchException in VerifyCsrfToken
due to CSRF protection.
The 'No Post Data Laravel Middleware' handles situations in which a post request has been submitted and contains no post data - a situation which should not occur under normal usage. By default, the middleware will redirect back to the previous page with an error message flashed to the session. This can then be output on your view as you would normally handle validation errors.
If needed, you can also modify this default behaviour and allow any code to run when the 'post request with no post data' situation is encountered.
Installation
- Run
composer require rapidwebltd/no-post-data-laravel-middleware
. - Add
RapidWeb\NoPostDataLaravelMiddleware\ServiceProvider::class,
to theproviders
array in yourconfig/app.php
file. - Add
\RapidWeb\NoPostDataLaravelMiddleware\Http\Middleware\NoPostData::class,
to themiddleware
array in yourapp/Http/Kernel.php
file. This must be added after\Illuminate\View\Middleware\ShareErrorsFromSession::class,
and before\App\Http\Middleware\VerifyCsrfToken::class,
. - Run
php artisan vendor:publish
. - If you wish, edit the default
errorMessage
variable in your newly publishedconfig/nopostdata.php
file. - If you want to fully change the middleware's behaviour, you can also edit the
closure
variable found in theconfig/nopostdata.php
file.