PHPackages                             trinityrank/tailing-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. trinityrank/tailing-slash

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

trinityrank/tailing-slash
=========================

TailingSlash adds '/' at the end of urls

v1.4.0(3y ago)0261MITPHPPHP ^7.4|^8.0

Since Feb 21Pushed 3y ago1 watchersCompare

[ Source](https://github.com/trinity-rank/tailing-slash)[ Packagist](https://packagist.org/packages/trinityrank/tailing-slash)[ Docs](https://github.com/trinity-rank/tailing-slash)[ RSS](/packages/trinityrank-tailing-slash/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (3)Versions (13)Used By (0)

Very short description of the package
=====================================

[](#very-short-description-of-the-package)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5b2dafa2b47dc98a0e8d426f6c66b8357697a3ee6830937de5115c14aca26fe1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7472696e6974792d72616e6b2f7461696c696e672d736c6173682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/trinityrank/tailing-slash)

Adds URL formatting and redirection with trailing slash to Laravel framework.

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 trinityrank/tailing-slash
```

### Step 2: Service Provider

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

After installing the package, register `Trinityrank\TailingSlash\RoutingServiceProvider` in your `config/app.php`.

```
    'providers' => [
        /*
        * Package Service Providers...
        */
        // ...
        Trinityrank\TailingSlash\RoutingServiceProvider::class
        // ...
    ],
    'aliases' => [
        // ...
        'UrlGenerator' => Trinityrank\TailingSlash\UrlGenerator::class,
        // ...
    ].
```

### Step 3: Routes

[](#step-3-routes)

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

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

### Usage

[](#usage)

Whenever you use some Laravel redirect function, tailing slash ("/") will be applied to the end of url.

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

    return back()->withInput();

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

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

### 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:

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

    $posts->links();
```

Pagiantion
----------

[](#pagiantion)

- Use this method to format pagination links on your blade component (tailwind.blade.php) and also use this for canonical links (check your `cleanCanonicalURL` in `BaseController`)

```
    UrlGenerator::paginationLinks($url)
```

- On your 'web.php' add page route for pagination. Use same `controller` and same `method` as you will use for normal archive page (just `path` is changed)
- ADD ABOVE THE REGILAR METHOD (not below)

```
    // Paginate emethod
    Route::get('{slug}/page/{page}', [FrontendController::class, 'resolve'])->name('resolve');
    // Your regulat method
    Route::get('{slug}', [FrontendController::class, 'resolve'])->name('resolve');
```

- In controller just add couple of thinks things
    - use `UrlGenerator` on top of the document
    - In method add new optional param `$pageNumber`
    - Add `UrlGenerator::paginationCheck` method at the beginning of the method

```
        use Trinityrank\TailingSlash\UrlGenerator;
        // ...
        public function method($slug, $pageNumber = null){
            // This add at the beginning of the method
            UrlGenerator::paginationCheck($pageNumber);
            // ...
        }
```

- Method `paginationCheck` has second optional paramether if default paginate keyword is not `page`

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 60% 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 ~21 days

Recently: every ~58 days

Total

12

Last Release

1300d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0529d66a2bad86fe77ead9c9cd33d611daaa00dcc73510603b17bab69b8ea196?d=identicon)[trinity-rank](/maintainers/trinity-rank)

---

Top Contributors

[![nebojsa-trinityrank](https://avatars.githubusercontent.com/u/87073514?v=4)](https://github.com/nebojsa-trinityrank "nebojsa-trinityrank (15 commits)")[![nemus-trinity](https://avatars.githubusercontent.com/u/55276977?v=4)](https://github.com/nemus-trinity "nemus-trinity (9 commits)")[![trinity-rank](https://avatars.githubusercontent.com/u/87767187?v=4)](https://github.com/trinity-rank "trinity-rank (1 commits)")

---

Tags

trinityranktailing-slash

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/trinityrank-tailing-slash/health.svg)

```
[![Health](https://phpackages.com/badges/trinityrank-tailing-slash/health.svg)](https://phpackages.com/packages/trinityrank-tailing-slash)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M683](/packages/barryvdh-laravel-ide-helper)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M210](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M858](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)[mrmarchone/laravel-auto-crud

Laravel Auto CRUD helps you streamline development and save time.

28711.8k2](/packages/mrmarchone-laravel-auto-crud)

PHPackages © 2026

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