PHPackages                             opgginc/codezero-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. opgginc/codezero-laravel-uri-translator

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

opgginc/codezero-laravel-uri-translator
=======================================

Translate a URI or individual slugs.

2.0.3(1mo ago)070.2k↓20%11MITPHPPHP ^8.1CI passing

Since Apr 6Pushed 1mo agoCompare

[ Source](https://github.com/opgginc/codezero-laravel-uri-translator)[ Packagist](https://packagist.org/packages/opgginc/codezero-laravel-uri-translator)[ Fund](https://paypal.me/ivanvermeyen)[ Fund](https://ko-fi.com/ivanvermeyen)[ RSS](/packages/opgginc-codezero-laravel-uri-translator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (6)Versions (6)Used By (1)

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

[](#laravel-uri-translator)

[![Laravel](https://camo.githubusercontent.com/22a9cba0109ed03b43979b14e29f4aca08931b4ece9609ced209dbd89cccb899/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d31332d7265643f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465)](https://laravel.com)[![License](https://camo.githubusercontent.com/881f0754deab24c469786c80608437a6046a45fcbee5381ddef5aff2be9a6c39/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6f706767696e632f636f64657a65726f2d6c61726176656c2d7572692d7472616e736c61746f722e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/f6157abcb1af065b4f2715de290ae914142716505361d23cbe06aee2797d670b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f706767696e632f636f64657a65726f2d6c61726176656c2d7572692d7472616e736c61746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/opgginc/codezero-laravel-uri-translator)

[![ko-fi](https://camo.githubusercontent.com/1fedf764fa06114b797ee53e7506df10880abed6766f854202d758df1707969d/68747470733a2f2f7777772e6b6f2d66692e636f6d2f696d672f676974687562627574746f6e5f736d2e737667)](https://ko-fi.com/R6R3UQ8V)

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.

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

[](#-requirements)

- PHP &gt;= 8.1
- Laravel &gt;= 10.0 (supports up to 13.0)

📦 Install
---------

[](#-install)

Install this package with Composer:

```
composer require opgginc/codezero-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) (Original Author) - Rest in Peace
- [OPGG Inc. Team](https://github.com/opgginc)
- [All contributors](https://github.com/opgginc/codezero-laravel-uri-translator/contributors)

> This package is a fork of the original work by Ivan Vermeyen. We are deeply saddened to share that Ivan has passed away. In memory of his excellent contribution to the Laravel community, we have forked this package to maintain and extend its functionality for newer Laravel versions. We extend our condolences to Ivan's family and friends.

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

[](#-security)

This project is maintained by OP.GG Inc. If you discover any security related issues, please use the issue tracker.

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

[](#-changelog)

This package is a fork of [codezero/laravel-uri-translator](https://github.com/codezero-be/laravel-uri-translator), updated to support Laravel 13.

📜 License
---------

[](#-license)

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

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance90

Actively maintained with recent releases

Popularity33

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~177 days

Total

3

Last Release

53d ago

PHP version history (2 changes)2.0.1PHP ^8.1|^8.2|^8.3|^8.4

2.0.2PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/728581edd89f77fbc41079c56d8942d3154c9cf9b8747a60bfb9b65825902f88?d=identicon)[kargnas](/maintainers/kargnas)

---

Top Contributors

[![ivanvermeyen](https://avatars.githubusercontent.com/u/3598622?v=4)](https://github.com/ivanvermeyen "ivanvermeyen (4 commits)")[![trippo](https://avatars.githubusercontent.com/u/497169?v=4)](https://github.com/trippo "trippo (2 commits)")[![jskorlol](https://avatars.githubusercontent.com/u/12728472?v=4)](https://github.com/jskorlol "jskorlol (1 commits)")[![kargnas](https://avatars.githubusercontent.com/u/1438533?v=4)](https://github.com/kargnas "kargnas (1 commits)")[![op-gg-ai-devops](https://avatars.githubusercontent.com/u/265863080?v=4)](https://github.com/op-gg-ai-devops "op-gg-ai-devops (1 commits)")

---

Tags

urluriphplaravellocalizationlanguagelocalecountryslugs

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[codezero/laravel-localized-routes

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

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

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

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

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

2770.1k1](/packages/opgginc-codezero-laravel-localized-routes)[awes-io/localization-helper

Package for convenient work with Laravel's localization features

3527.1k4](/packages/awes-io-localization-helper)[vluzrmos/language-detector

Detect the language for your application using browser preferences, subdomains or route prefixes.

109554.8k3](/packages/vluzrmos-language-detector)[longman/laravel-multilang

Package to integrate multi language (multi locale) functionality in Laravel 5.x

5514.4k1](/packages/longman-laravel-multilang)

PHPackages © 2026

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