PHPackages                             parfaitementweb/laravel-uri-translator - 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. [Localization &amp; i18n](/categories/localization)
4. /
5. parfaitementweb/laravel-uri-translator

ActiveLibrary[Localization &amp; i18n](/categories/localization)

parfaitementweb/laravel-uri-translator
======================================

Translate a URI or individual slugs.

v3.0.0(1mo ago)034↓72%1MITPHPPHP ^8.3CI passing

Since Jun 10Pushed 1mo agoCompare

[ Source](https://github.com/parfaitementweb/laravel-uri-translator)[ Packagist](https://packagist.org/packages/parfaitementweb/laravel-uri-translator)[ RSS](/packages/parfaitementweb-laravel-uri-translator/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (3)Versions (2)Used By (1)

Laravel URI Translator
======================

[](#laravel-uri-translator)

[![GitHub release](https://camo.githubusercontent.com/51919b42fb839461d8f4f30a2d72eb9ccf4296edbba45c2ef05f733b148d8b25/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f70617266616974656d656e747765622f6c61726176656c2d7572692d7472616e736c61746f722e7376673f7374796c653d666c61742d737175617265)](https://github.com/parfaitementweb/laravel-uri-translator/releases)[![Laravel](https://camo.githubusercontent.com/f14b7d5e61ff0357cc97bc85c1ed1924b12d4ba2c347808bee2c6fcd44c61eb1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d313225323025374325323031332d7265643f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465)](https://laravel.com)[![License](https://camo.githubusercontent.com/c34ca6282b72f0aba906b23dd6d7840735239723cdc2cf67ac4414e5f6827568/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f70617266616974656d656e747765622f6c61726176656c2d7572692d7472616e736c61746f722e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/c901e2e72a17345f2ac6b6180f59d8168310141ce357eddb8054cfc826e6a1f5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f70617266616974656d656e747765622f6c61726176656c2d7572692d7472616e736c61746f722f72756e2d74657374732e796d6c3f7374796c653d666c61742d737175617265266c6f676f3d676974687562266c6f676f436f6c6f723d7768697465266c6162656c3d7465737473)](https://github.com/parfaitementweb/laravel-uri-translator/actions)[![Total Downloads](https://camo.githubusercontent.com/fce7782d6997f2dad9a43bbb072175ff13b06fb5be795cbcef4d1e1e63dd37a6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70617266616974656d656e747765622f6c61726176656c2d7572692d7472616e736c61746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/parfaitementweb/laravel-uri-translator)

This package registers a macro for the Laravel `Translator` class. This will allow you to translate individual URI slugs, while ignoring parameter placeholders.

Parameters will not be translated by this macro. That remains the responsibility of your code.

> **Maintained fork.** This is a community-maintained fork of the original [codezero-be/laravel-uri-translator](https://github.com/codezero-be/laravel-uri-translator)by Ivan Vermeyen, updated to support Laravel 12 and 13. All credit for the original work goes to the CodeZero team.

✅ Requirements
--------------

[](#-requirements)

- PHP &gt;= 8.3
- Laravel 12 or 13

📦 Install
---------

[](#-install)

Install this package with Composer:

```
composer require parfaitementweb/laravel-uri-translator
```

Laravel will automatically register the ServiceProvider.

In your app's `lang` folder, create subdirectories for every locale you want to have translations for.

Next create a `routes.php` file in each of those directories.

```
lang/
  ├── en/
  │    └── routes.php
  └── nl/
       └── routes.php

```

Return an array of translations from the `routes.php` files.

### 🚀 Usage

[](#-usage)

Use the `Lang::uri()` macro when registering routes:

```
Route::get(Lang::uri('hello/world'), [Controller::class, 'index']);
```

The URI macro accepts 2 additional parameters:

1. A locale, in case you need translations to a locale other than the current app locale.
2. A namespace, in case your translation files reside in a package.

```
Lang::uri('hello/world', 'fr', 'my-package');
```

You can also use `trans()->uri('hello/world')` instead of `Lang::uri('hello/world')`.

### 🔌 Example

[](#-example)

Using these example translations:

```
// lang/nl/routes.php
return [
    'hello' => 'hallo',
    'world' => 'wereld',
    'override/hello/world' => 'something/very/different',
    'hello/world/{parameter}' => 'uri/with/{parameter}',
];
```

These are possible translation results:

```
// Translate every slug individually
// Translates to: 'hallo/wereld'
Lang::uri('hello/world');

// Keep original slug when missing translation
// Translates to: 'hallo/big/wereld'
Lang::uri('hello/big/world');

// Translate slugs, but not parameter placeholders
// Translates to: 'hallo/{world}'
Lang::uri('hello/{world}');

// Translate full URIs if an exact translation exists
// Translates to: 'something/very/different'
Lang::uri('override/hello/world');

// Translate full URIs if an exact translation exists (with placeholder)
// Translates to: 'uri/with/{parameter}'
Lang::uri('hello/world/{parameter}');
```

🚧 Testing
---------

[](#-testing)

```
composer test
```

☕️ Credits
----------

[](#️-credits)

- [Ivan Vermeyen](https://github.com/ivanvermeyen)
- [All contributors](https://github.com/codezero-be/laravel-uri-translator/contributors)

🔒 Security
----------

[](#-security)

If you discover any security related issues, please [e-mail me](mailto:ivan@codezero.be) instead of using the issue tracker.

📑 Changelog
-----------

[](#-changelog)

A complete list of all notable changes to this package can be found on the [releases page](https://github.com/codezero-be/laravel-uri-translator/releases).

📜 License
---------

[](#-license)

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

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance90

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity48

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

46d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/67c747d82e5989eeae3f98ae775f6e9d9aaee286e221e9f35a446e0f440421a8?d=identicon)[parfaitementweb](/maintainers/parfaitementweb)

---

Top Contributors

[![AlexisSerneels](https://avatars.githubusercontent.com/u/287688?v=4)](https://github.com/AlexisSerneels "AlexisSerneels (1 commits)")

---

Tags

urluriphplaravellocalizationlanguagelocalecountryslugs

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/parfaitementweb-laravel-uri-translator/health.svg)

```
[![Health](https://phpackages.com/badges/parfaitementweb-laravel-uri-translator/health.svg)](https://phpackages.com/packages/parfaitementweb-laravel-uri-translator)
```

###  Alternatives

[codezero/laravel-localized-routes

A convenient way to set up, manage and use localized routes in a Laravel app.

544664.5k4](/packages/codezero-laravel-localized-routes)[codezero/laravel-localizer

Automatically detect and set an app locale that matches your visitor's preference.

50404.9k4](/packages/codezero-laravel-localizer)[opgginc/codezero-laravel-localized-routes

A convenient way to set up, manage and use localized routes in a Laravel app.

29119.1k1](/packages/opgginc-codezero-laravel-localized-routes)[niels-numbers/laravel-localizer

Detects the user’s preferred language and redirects to the matching localized URL.

183.4k](/packages/niels-numbers-laravel-localizer)[awes-io/localization-helper

Package for convenient work with Laravel's localization features

3527.1k4](/packages/awes-io-localization-helper)[erag/laravel-lang-sync-inertia

A powerful Laravel package for syncing and managing language translations across backend and Inertia.js (Vue/React/Svelte) frontends, offering effortless localization, auto-sync features, and smooth multi-language support for modern Laravel applications.

4925.3k](/packages/erag-laravel-lang-sync-inertia)

PHPackages © 2026

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