PHPackages                             oddvalue/laravel-db-router - 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. oddvalue/laravel-db-router

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

oddvalue/laravel-db-router
==========================

Routing through the database in Laravel

v0.0.1(8mo ago)01MITPHPPHP ~8.3|~8.4CI passing

Since Nov 5Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/oddvalue/laravel-db-router)[ Packagist](https://packagist.org/packages/oddvalue/laravel-db-router)[ Docs](https://github.com/oddvalue/laravel-db-router)[ RSS](/packages/oddvalue-laravel-db-router/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (1)Dependencies (7)Versions (4)Used By (0)

WIP: Laravel Database Routing
=============================

[](#wip-laravel-database-routing)

This package is a work in progress and is not production ready.

[![Latest Version on Packagist](https://camo.githubusercontent.com/c789f69b203c683c4ac513a9191607a113492ec870f80ea838395a1114ac4f5b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f646476616c75652f6c61726176656c2d64622d726f757465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oddvalue/laravel-db-router)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![CI](https://github.com/oddvalue/laravel-db-router/actions/workflows/ci.yml/badge.svg)](https://github.com/oddvalue/laravel-db-router/actions/workflows/ci.yml)[![Coverage](https://camo.githubusercontent.com/ee6ce3027a9e0cfc7303fb4b82f50358fdb3cf976be953e4bc699ea9b817d9f9/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f75726c3d68747470733a2f2f676973742e67697468756275736572636f6e74656e742e636f6d2f6f646476616c75652f31623961363364316164616339386534343662396262356235393164336538312f7261772f666462323062363630336232383238323431326164323236663834386463336630616662346333322f6c61726176656c2d64622d726f757465722d636f626572747572612d636f7665726167652e6a736f6e)](https://github.com/oddvalue/laravel-db-router/actions/workflows/ci.yml)[![Total Downloads](https://camo.githubusercontent.com/43e1af8aca9da8751aa73e64301c5c3aa46026cb60bd952c9172b20f05f56bed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f646476616c75652f6c61726176656c2d64622d726f757465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oddvalue/laravel-db-router)

- [Requirements](#Requirements)
- [Install](#Install)
- [Usage](#Usage)
    - [Preparing Your Model](#PreparingYourModel)
    - [Route Generators](#RouteGenerators)
- [Change log](#Changelog)
- [Testing](#Testing)
- [Contributing](#Contributing)
- [Security](#Security)
- [Credits](#Credits)
- [License](#License)

This package allows you to set up dynamic routes for Laravel models in the database.

Features include:

- Automatically generate and store URLs for models in the database for dynamic routing.
- Remember old URLs and 301 redirect to the current one.
- Store multiple URLs with one as the main, canonical.
- Automatically update child page URLs when a parent's is updated.

Requirements
----------------------------------------------------

[](#requirements)

- PHP &gt;= 8.2
- Laravel 12.x
- [oddvalue/link-builder](https://github.com/oddvalue/link-builder) &gt;= 2.0.0

Install
------------------------------------------

[](#install)

Via Composer

```
composer require oddvalue/laravel-db-router
```

Publish and migrate

```
php artisan vendor:publish --provider "Oddvalue\DbRouter\DbRouterServiceProvider"
php artisan migrate
```

Usage
--------------------------------------

[](#usage)

### Preparing Your Model

[](#preparing-your-model)

In order to use this package your model must implement the [`\Oddvalue\DbRouter\Contracts\Routable`](src/Contracts/Routable.php) interface.

Optionally, you may use the [`\Oddvalue\DbRouter\Traits\HasRoutes`](src/Traits/HasRoutes.php) trait to handle most of the interface implementation for you. Using the trait requires your model to have a `getRouteGeneratorClass` method that returns the fully qualified class name of the generator class for setting up the routes.

### Route Generators

[](#route-generators)

The route generator class is responsible for getting the URLs that a model is accessible from and what controller action should be performed when that URL is hit. Generators must implement the `\Oddvalue\DbRouter\Contracts\RouteGenerator` interface. There is also a `\Oddvalue\DbRouter\Contracts\ChildRouteGenerator` interface. Once implemented this will allow the package to also generate and update routes for child pages of your model.

### Using The Link Builder Package

[](#using-the-link-builder-package)

The default implementation of the route generator uses [oddvalue/link-builder](https://github.com/oddvalue/link-builder) to generate

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

[](#change-log)

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

Testing
------------------------------------------

[](#testing)

```
$ composer test
```

### Static analysis

[](#static-analysis)

Run PHPStan (with Larastan) at the highest level:

```
composer phpstan
```

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------------------------------------------

[](#security)

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

Credits
------------------------------------------

[](#credits)

- [Jim Hollington](https://github.com/oddvalue)
- [All Contributors](../../contributors)

License
------------------------------------------

[](#license)

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

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance62

Regular maintenance activity

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

241d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8445ea4661367cd677e1c3caa05c7e4021f30ff5ca7978e9f436bc7fd7532bf5?d=identicon)[oddvalue](/maintainers/oddvalue)

---

Top Contributors

[![oddvalue](https://avatars.githubusercontent.com/u/10127404?v=4)](https://github.com/oddvalue "oddvalue (18 commits)")

---

Tags

oddvaluelaravel-db-router

###  Code Quality

TestsPest

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/oddvalue-laravel-db-router/health.svg)

```
[![Health](https://phpackages.com/badges/oddvalue-laravel-db-router/health.svg)](https://phpackages.com/packages/oddvalue-laravel-db-router)
```

###  Alternatives

[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

17878.9k](/packages/markwalet-nova-modal-response)[crumbls/layup

A visual page builder plugin for Filament 5 — Divi-style grid layouts with extensible widgets.

592.7k1](/packages/crumbls-layup)[team-nifty-gmbh/tall-datatables

Server-side rendered datatables for Laravel and Livewire

1320.9k4](/packages/team-nifty-gmbh-tall-datatables)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.4k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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