Download the PHP package fsasvari/laravel-trailing-slash without Composer
On this page you can find all versions of the php package fsasvari/laravel-trailing-slash. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-trailing-slash
Laravel Trailing Slash
Adds url formatting and redirection with trailing slash to Laravel framework versions 13.x, 12.x, 11.x, 10.x, 9.x, 8.x, 7.x, 6.x and 5.x.
Compatibility Chart
| Laravel Trailing Slash | Laravel | PHP |
|---|---|---|
| 8.x | 13.x | 8.3+ |
| 7.x | 12.x | 8.2+ |
| 6.x | 11.x | 8.2+ |
| 5.x | 10.x | 8.1+ |
| 4.x | 9.x | 8.0.2+ |
| 3.x | 8.x | 7.3+/8.0+ |
| 2.x | 7.x | 7.3+ |
| 1.x | 6.x | 7.2+ |
| 0.3.x | 5.7-5.8 | 7.1.3+ |
| 0.2.x | 5.6 | 7.1.3+ |
| 0.1.x | 5.5 | 7.0.0+ |
Installation
Step 1: Install package
To get started with Laravel Trailing Slash, use Composer command to add the package to your composer.json project's dependencies:
Or add it directly by copying next line into composer.json:
Step 2: Service Provider
Laravel automatically discovers this package via package auto-discovery, so manual registration is usually not required.
If you have disabled auto-discovery or prefer manual registration:
-
For
Laravel 11.xand above, register theLaravelTrailingSlash\RoutingServiceProviderin yourbootstrap/providers.phpconfiguration file: - For
Laravel 10.xand below, register theLaravelTrailingSlash\RoutingServiceProviderin yourconfig/app.phpconfiguration file:
Step 3: .htaccess
If you are using apache, copy following redirection code from public/.htaccess to your own project:
Step 4: Routes
In routes/web.php, you must use routes with trailing slashes now:
Usage
Every time you use some Laravel redirect function, trailing slash ("/") will be applied at the end of url.
Change log
Please see CHANGELOG for more information what has changed recently.
Notice
There is a problem with overriding Laravel Paginator and LengthAwarePaginator classes. So, every time you use paginate() method on your models, query builders etc., you must set current path for pagination links. Example:
Licence
MIT Licence. Refer to the LICENSE file to get more info.
Author
Frano Šašvari
Email: [email protected]
