PHPackages                             silverhand7/laravel-trailing-slash - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. silverhand7/laravel-trailing-slash

ActiveLibrary[HTTP &amp; Networking](/categories/http)

silverhand7/laravel-trailing-slash
==================================

The package that adds redirection with trailing slash to Laravel framework.

v5.0.1(2y ago)04.5kMITPHPPHP ^8.1

Since Jul 27Pushed 2y agoCompare

[ Source](https://github.com/silverhand7/laravel-trailing-slash)[ Packagist](https://packagist.org/packages/silverhand7/laravel-trailing-slash)[ Docs](https://github.com/silverhand7/laravel-trailing-slash)[ RSS](/packages/silverhand7-laravel-trailing-slash/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (4)Versions (31)Used By (0)

Laravel Trailing Slash
======================

[](#laravel-trailing-slash)

Adds url formatting and redirection with trailing slash to Laravel framework versions 10.x, 9.x, 8.x, 7.x, 6.x and 5.x.

[![Build For Laravel](https://camo.githubusercontent.com/9d0e49e88cc565047271b33091f74c61bd665a5690747864fcff8e335eb285e9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4275696c745f666f722d4c61726176656c2d6f72616e67652e737667)](https://styleci.io/repos/79834672)[![Latest Stable Version](https://camo.githubusercontent.com/b2a935a647626f1908d2d881de375f222a0167dcecf363dd8511f61551dcb4cd/68747470733a2f2f706f7365722e707567782e6f72672f66736173766172692f6c61726176656c2d747261696c696e672d736c6173682f762f737461626c65)](https://packagist.org/packages/fsasvari/laravel-trailing-slash)[![Latest Unstable Version](https://camo.githubusercontent.com/75c7a24aeb0e216d602c891fbaef42d5c110b24c73362e4d6b0098c043f2b25e/68747470733a2f2f706f7365722e707567782e6f72672f66736173766172692f6c61726176656c2d747261696c696e672d736c6173682f762f756e737461626c65)](https://packagist.org/packages/fsasvari/laravel-trailing-slash)[![Total Downloads](https://camo.githubusercontent.com/345f99f8bed0f71690f5b9ff7c7f95973cb9cd95364c5716dec00f174ddfac5e/68747470733a2f2f706f7365722e707567782e6f72672f66736173766172692f6c61726176656c2d747261696c696e672d736c6173682f646f776e6c6f616473)](https://packagist.org/packages/fsasvari/laravel-trailing-slash)[![License](https://camo.githubusercontent.com/3c3d74cafe79223c742a81b4435db4205543499fb054b5a69d6c12c3648b9fd8/68747470733a2f2f706f7365722e707567782e6f72672f66736173766172692f6c61726176656c2d747261696c696e672d736c6173682f6c6963656e7365)](https://packagist.org/packages/fsasvari/laravel-trailing-slash)

Compatibility Chart
-------------------

[](#compatibility-chart)

Laravel Trailing SlashLaravelPHP[5.x](https://github.com/fsasvari/laravel-trailing-slash/tree/v5.0.0)10.x8.1+[4.x](https://github.com/fsasvari/laravel-trailing-slash/tree/v4.0.0)9.x8.0.2+[3.x](https://github.com/fsasvari/laravel-trailing-slash/tree/v3.0.0)8.x7.3+/8.0+[2.x](https://github.com/fsasvari/laravel-trailing-slash/tree/v2.0.2)7.x7.3+[1.x](https://github.com/fsasvari/laravel-trailing-slash/tree/v1.1.0)6.x7.2+[0.3.x](https://github.com/fsasvari/laravel-trailing-slash/tree/0.3)5.7-5.87.1.3+[0.2.x](https://github.com/fsasvari/laravel-trailing-slash/tree/0.2)5.67.1.3+[0.1.x](https://github.com/fsasvari/laravel-trailing-slash/tree/0.1)5.57.0.0+Installation
------------

[](#installation)

### Step 1: Install package

[](#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:

```
composer require fsasvari/laravel-trailing-slash

```

Or add it directly by copying next line into composer.json:

```
"fsasvari/laravel-trailing-slash": "5.*"

```

### Step 2: Service Provider

[](#step-2-service-provider)

After installing the Laravel Trailing Slash library, register the `LaravelTrailingSlash\RoutingServiceProvider` in your `config/app.php` configuration file:

```
'providers' => [
    // Application Service Providers...
    // ...

    // Other Service Providers...
    LaravelTrailingSlash\RoutingServiceProvider::class,
    // ...
],
```

### Step 3: .htaccess

[](#step-3-htaccess)

If you are using apache, copy following redirection code from `public/.htaccess` to your own project:

```

    # Redirect To Trailing Slashes If Not A Folder Or A File...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !(/$|\.)
    RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]

```

### Step 4: Routes

[](#step-4-routes)

In routes/web.php, you must use routes with trailing slashes now:

```
Route::get('/', function () {
    return view('welcome');
});

Route::get('about/', function () {
    return view('about');
});

Route::get('contact/', function () {
    return view('contact');
});
```

Usage
-----

[](#usage)

Every time you use some Laravel redirect function, trailing slash ("/") will be applied at the end of url.

```
return redirect('about/');

return back()->withInput();

return redirect()->route('text', ['id' => 1]);

return redirect()->action('IndexController@about');
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Notice
------

[](#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:

```
$texts = Text::where('is_active', 1)->paginate();
$texts->setPath(URL::current());

$texts->links();
```

Licence
-------

[](#licence)

MIT Licence. Refer to the [LICENSE](https://github.com/fsasvari/laravel-trailing-slash/blob/master/LICENSE.md) file to get more info.

Author
------

[](#author)

Frano Šašvari

Email:

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 82.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~80 days

Recently: every ~277 days

Total

30

Last Release

888d ago

Major Versions

0.3.x-dev → v1.0.02019-11-14

v1.1.0 → v2.0.02020-04-01

v2.0.2 → v3.0.02020-11-23

v3.0.0 → v4.0.02022-06-21

v4.0.2 → v5.0.12023-12-07

PHP version history (6 changes)v0.3.2PHP ^7.1.3

v1.0.0PHP ^7.2

v2.0.0PHP ^7.3

v3.0.0PHP ^7.3|^8.0

v4.0.1PHP ^8.0.2

v5.0.1PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/f0b2a1a8be7846dd50cb9ad5f77d9a9832c54c7caca24888f4680ee71ff0fb23?d=identicon)[silverhand7](/maintainers/silverhand7)

---

Top Contributors

[![fsasvari](https://avatars.githubusercontent.com/u/4989168?v=4)](https://github.com/fsasvari "fsasvari (67 commits)")[![DevDavido](https://avatars.githubusercontent.com/u/997605?v=4)](https://github.com/DevDavido "DevDavido (6 commits)")[![silverhand7](https://avatars.githubusercontent.com/u/30499443?v=4)](https://github.com/silverhand7 "silverhand7 (6 commits)")[![sailingdeveloper](https://avatars.githubusercontent.com/u/3988671?v=4)](https://github.com/sailingdeveloper "sailingdeveloper (1 commits)")[![WayneBrummer](https://avatars.githubusercontent.com/u/4981767?v=4)](https://github.com/WayneBrummer "WayneBrummer (1 commits)")

---

Tags

phplaravelredirect

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/silverhand7-laravel-trailing-slash/health.svg)

```
[![Health](https://phpackages.com/badges/silverhand7-laravel-trailing-slash/health.svg)](https://phpackages.com/packages/silverhand7-laravel-trailing-slash)
```

###  Alternatives

[omniphx/forrest

A Laravel library for Salesforce

2724.4M8](/packages/omniphx-forrest)[fsasvari/laravel-trailing-slash

The package that adds redirection with trailing slash to Laravel framework.

63164.3k](/packages/fsasvari-laravel-trailing-slash)[basement-chat/basement-chat

Add a real-time chat widget to your Laravel application.

4983.9k](/packages/basement-chat-basement-chat)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[dragon-code/laravel-http-logger

Logging incoming HTTP requests

319.8k3](/packages/dragon-code-laravel-http-logger)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
