PHPackages                             marshmallow/redirectable - 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. marshmallow/redirectable

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

marshmallow/redirectable
========================

Store redirects via Nova and load them in your routes

v5.1.0(3mo ago)012.5k↓78.6%1[1 PRs](https://github.com/marshmallow-packages/redirectable/pulls)2MITPHPPHP ^8.1CI failing

Since Jan 20Pushed 2w ago1 watchersCompare

[ Source](https://github.com/marshmallow-packages/redirectable)[ Packagist](https://packagist.org/packages/marshmallow/redirectable)[ Docs](https://gitlab.com/marshmallow-packages/redirectable)[ RSS](/packages/marshmallow-redirectable/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)Dependencies (10)Versions (21)Used By (2)

[![alt text](https://camo.githubusercontent.com/f5450f299f5713ce2f04dd5a1ba7ce9960ed4568b3574e4c4ee3cddc75477253/68747470733a2f2f6d617273686d616c6c6f772e6465762f63646e2f6d656469612f6c6f676f2d7265642d3233377834362e706e67 "marshmallow.")](https://camo.githubusercontent.com/f5450f299f5713ce2f04dd5a1ba7ce9960ed4568b3574e4c4ee3cddc75477253/68747470733a2f2f6d617273686d616c6c6f772e6465762f63646e2f6d656469612f6c6f676f2d7265642d3233377834362e706e67)

Laravel Redirectable
====================

[](#laravel-redirectable)

[![Latest Version on Packagist](https://camo.githubusercontent.com/69c81401f431561e895c6a955a3dc55bc49d1240020bdd7e8c6be1fbc14ed75c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d617273686d616c6c6f772f726564697265637461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/marshmallow/redirectable)[![Tests](https://camo.githubusercontent.com/4ed65f6db3e361f070a9fec629c0b9d21a75db436bcf90aa6c9bc44e6bdfa772/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d617273686d616c6c6f772d7061636b616765732f726564697265637461626c652f7068702d73796e7461782d636865636b65722e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/marshmallow-packages/redirectable/actions/workflows/php-syntax-checker.yml)[![Total Downloads](https://camo.githubusercontent.com/0ef221de0c61b520454523041e29a4dae3a74a61a7bee05328a276b2d94c6ef5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d617273686d616c6c6f772f726564697265637461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/marshmallow/redirectable)

Store redirects via Nova and load them in your routes.

Redirectable lets you manage HTTP redirects from a [Laravel Nova](https://nova.laravel.com) resource and serve them as real, cacheable routes. Redirects can be standalone or attached (polymorphically) to any Eloquent model — for example a page resource — so that when a model's slug changes, its old URLs keep pointing at the right place.

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require marshmallow/redirectable
```

The service provider is auto-discovered and the package migrations are loaded automatically. Run them with:

```
php artisan migrate
```

This creates the `redirects` table.

Optionally publish the config file:

```
php artisan vendor:publish --provider="Marshmallow\Redirectable\RedirectableServiceProvider"
```

Configuration
-------------

[](#configuration)

The published `config/redirectable.php` exposes the following keys:

KeyDefaultDescription`database.connection``null`Database connection used when checking whether redirect routes should be loaded. `null` uses the default connection.`models.redirect``Marshmallow\Redirectable\Models\Redirect::class`The Eloquent model used to store and resolve redirects. Override to use your own model.`types``[Marshmallow\Pages\Nova\Page::class]`Nova resources that may be associated with a redirect via the `MorphTo` field.`http_codes``[301 => '301 Moved Permanently']`The HTTP status codes selectable in Nova when creating a redirect.Usage
-----

[](#usage)

### Register the redirect routes

[](#register-the-redirect-routes)

Call `Redirector::routes()` in your `routes/web.php` so the stored redirects are registered as routes. They are added last, never overriding existing application routes, and can be route-cached:

```
use Marshmallow\Redirectable\Facades\Redirector;

// routes/web.php — register this after your own routes
Redirector::routes();
```

When a registered redirect URL is hit, the package resolves the final destination (following chained redirects) and returns a redirect response with the configured HTTP code.

### Manage redirects in Nova

[](#manage-redirects-in-nova)

Register the bundled Nova resource in your `NovaServiceProvider`:

```
use Marshmallow\Redirectable\Nova\Redirect;

protected function resources(): void
{
    Nova::resources([
        Redirect::class,
    ]);
}
```

The resource appears under the **SEO** group and lets you set the source path (`redirect this`), the destination (`to this`), the HTTP code, and an optional associated resource.

### Attach redirects to a model

[](#attach-redirects-to-a-model)

Add the `Redirectable` trait to any model you want to attach redirects to. It provides a `redirectable()` morph-many relation:

```
use Illuminate\Database\Eloquent\Model;
use Marshmallow\Redirectable\Traits\Redirectable;

class Page extends Model
{
    use Redirectable;
}
```

You can then create redirects for that model through the `Redirector` facade. `add()` records a redirect, removes redirects made obsolete by the new destination, and re-points existing trailing redirects to the new destination:

```
use Marshmallow\Redirectable\Facades\Redirector;

Redirector::add($page, '/old-url', '/new-url');
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

Contributing
------------

[](#contributing)

Please see the Marshmallow packages contribution process for details. Pull requests are welcome.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Stef van Esch](https://github.com/marshmallow-packages)
- [All Contributors](https://github.com/marshmallow-packages/redirectable/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see the [License File](LICENSE.md) for more information.

###  Health Score

53

—

FairBetter than 96% of packages

Maintenance89

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 70% 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 ~117 days

Recently: every ~112 days

Total

17

Last Release

108d ago

Major Versions

v1.1.1 → v2.0.02022-05-04

v1.1.2 → v2.1.12023-04-03

v1.1.3 → v2.1.22024-03-12

v2.3.0 → v5.0.02025-08-07

PHP version history (5 changes)v1.0.0PHP ^7.4|^8.0

v1.1.1PHP ^7.4|^8.0|^8.1

v2.0.0PHP ^8.0|^8.1

v2.1.0PHP ^8.0

v2.1.2PHP ^8.1

### Community

Maintainers

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

---

Top Contributors

[![stefvanesch](https://avatars.githubusercontent.com/u/46725619?v=4)](https://github.com/stefvanesch "stefvanesch (35 commits)")[![LTKort](https://avatars.githubusercontent.com/u/2412670?v=4)](https://github.com/LTKort "LTKort (10 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")

---

Tags

marshmallowlaravel-redirectable

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/marshmallow-redirectable/health.svg)

```
[![Health](https://phpackages.com/badges/marshmallow-redirectable/health.svg)](https://phpackages.com/packages/marshmallow-redirectable)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[api-platform/laravel

API Platform support for Laravel

58171.5k14](/packages/api-platform-laravel)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M193](/packages/laravel-ai)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k91.0k1](/packages/mike-bronner-laravel-model-caching)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2051.5M2](/packages/glushkovds-phpclickhouse-laravel)

PHPackages © 2026

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