PHPackages                             vlados/laravel-unique-urls - 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. vlados/laravel-unique-urls

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

vlados/laravel-unique-urls
==========================

A package for using and generating unique urls for each Eloquent model in Laravel

v2.1.1(1mo ago)01.8k↓78.6%[5 PRs](https://github.com/vlados/laravel-unique-urls/pulls)MITPHPPHP ^8.2

Since Jun 7Pushed 4d ago1 watchersCompare

[ Source](https://github.com/vlados/laravel-unique-urls)[ Packagist](https://packagist.org/packages/vlados/laravel-unique-urls)[ Docs](https://github.com/vlados/laravel-unique-urls)[ GitHub Sponsors](https://github.com/vlados)[ RSS](/packages/vlados-laravel-unique-urls/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (10)Dependencies (34)Versions (213)Used By (0)

Unique Urls for Laravel
=======================

[](#unique-urls-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ccbe7778ca52c0addf719ac9440abf6d021a22b43cf90e8ca7ebc30e0c46aa5c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f766c61646f732f6c61726176656c2d756e697175652d75726c732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vlados/laravel-unique-urls)[![GitHub Tests Action Status](https://camo.githubusercontent.com/35c8cfc68b6af84ca44df10b6123a87ce8985d750648ab1ae2ab46e11f4cc0d9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f766c61646f732f6c61726176656c2d756e697175652d75726c732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/vlados/laravel-unique-urls/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/8a0861e39a54229c566f7293077cc568a3897f03d1c39cca9602137361a63a55/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f766c61646f732f6c61726176656c2d756e697175652d75726c732f7068702d63732d66697865722e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/vlados/laravel-unique-urls/actions?query=workflow%3Aphp-cs-fixer+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/4701b2c16cb0156dc631994b312d1d51dab582019ea642fac0303526ae10fc42/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f766c61646f732f6c61726176656c2d756e697175652d75726c732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vlados/laravel-unique-urls)[![PHP Insights](https://github.com/vlados/laravel-unique-urls/actions/workflows/insights.yaml/badge.svg)](https://github.com/vlados/laravel-unique-urls/actions/workflows/insights.yaml)[![PHPStan](https://github.com/vlados/laravel-unique-urls/actions/workflows/phpstan.yml/badge.svg)](https://github.com/vlados/laravel-unique-urls/actions/workflows/phpstan.yml)

Generate unique, prefix-free URLs for any Eloquent model — blogs, e-commerce, multi-language platforms.

**PHP 8.2+ | Laravel 11, 12**

Features
--------

[](#features)

- Auto-trim slashes to prevent 404 errors
- Multi-language URLs (distinct slugs per locale, not just prefixes)
- Automatic redirects when URLs change (301 by default)
- Hierarchical URLs via parent relationships (e.g. `category/product`)
- Livewire full-page component support (FQCN and SFC names)
- Batch generation with progress tracking for large datasets
- Slug validation and reserved-slug protection
- `urls:doctor` command for configuration health checks

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

[](#installation)

```
composer require vlados/laravel-unique-urls
php artisan vendor:publish --tag="laravel-unique-urls-migrations"
php artisan migrate
```

Quick Start
-----------

[](#quick-start)

Add the trait to your model and define how URLs are built:

```
use Vlados\LaravelUniqueUrls\HasUniqueUrls;

class Product extends Model
{
    use HasUniqueUrls;

    public function urlStrategy($language, $locale): string
    {
        return Str::slug($this->name, '-', $locale);
    }

    public function urlHandler(): array
    {
        return [
            'controller' => ProductController::class,
            'method'     => 'view',
            'arguments'  => [],
        ];
    }
}
```

Register the catch-all route at the **end** of `routes/web.php`:

```
Route::get('{urlObj}', [\Vlados\LaravelUniqueUrls\LaravelUniqueUrlsController::class, 'handleRequest'])
    ->where('urlObj', '.*');
```

Access URLs on any model instance:

```
$product->relative_url;  // "my-product"
$product->absolute_url;  // "https://example.com/my-product"
$product->getSlug('en'); // slug for a specific language
```

Documentation
-------------

[](#documentation)

- [Configuration](docs/configuration.md) — config options and defaults
- [Usage](docs/usage.md) — model setup, routes, multi-language, Livewire
- [Bulk Operations](docs/bulk-operations.md) — batch generation, global toggles, performance
- [Artisan Commands](docs/artisan-commands.md) — `urls:generate` and `urls:doctor`
- [Testing](docs/testing.md) — assertion helpers and example tests
- [Troubleshooting](docs/troubleshooting.md) — common issues and fixes

Changelog
---------

[](#changelog)

See [CHANGELOG.md](CHANGELOG.md) for release history.

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

[](#contributing)

This project follows [Conventional Commits](https://www.conventionalcommits.org/).

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

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Vladislav Stoitsov](https://github.com/vlados)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). See [LICENSE.md](LICENSE.md) for details.

###  Health Score

55

—

FairBetter than 97% of packages

Maintenance97

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 82.8% 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 ~91 days

Recently: every ~28 days

Total

17

Last Release

32d ago

Major Versions

v0.4.1 → v1.0.02025-10-01

v1.2.0 → v2.0.02026-02-12

PHP version history (3 changes)v0.1.0PHP ^8.0|^8.1

v0.4.1PHP ^8.1

v2.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/20ebf35eac0da0d3775f3a64bdd9dc0e9dfa11bc9a3c3ee9db92deef9dbf8bd8?d=identicon)[vlados](/maintainers/vlados)

---

Top Contributors

[![vlados](https://avatars.githubusercontent.com/u/46914?v=4)](https://github.com/vlados "vlados (149 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (16 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (14 commits)")[![claude[bot]](https://avatars.githubusercontent.com/in/1236702?v=4)](https://github.com/claude[bot] "claude[bot] (1 commits)")

---

Tags

laravelpackagesunique-urlslaravelvladoslaravel-unique-urls

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/vlados-laravel-unique-urls/health.svg)

```
[![Health](https://phpackages.com/badges/vlados-laravel-unique-urls/health.svg)](https://phpackages.com/packages/vlados-laravel-unique-urls)
```

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329530.5k29](/packages/codewithdennis-filament-select-tree)[finity-labs/fin-mail

A powerful email template manager and composer for Filament with dynamic token replacement, template versioning, and inline email sending.

284.5k1](/packages/finity-labs-fin-mail)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

124603.0k](/packages/worksome-exchange)

PHPackages © 2026

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