Download the PHP package parfaitementweb/laravel-uri-translator without Composer
On this page you can find all versions of the php package parfaitementweb/laravel-uri-translator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download parfaitementweb/laravel-uri-translator
More information about parfaitementweb/laravel-uri-translator
Files in parfaitementweb/laravel-uri-translator
Package laravel-uri-translator
Short Description Translate a URI or individual slugs.
License MIT
Informations about the package laravel-uri-translator
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 by Ivan Vermeyen, updated to support Laravel 12 and 13. All credit for the original work goes to the CodeZero team.
✅ Requirements
- PHP >= 8.3
- Laravel 12 or 13
📦 Install
Install this package with Composer:
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.
Return an array of translations from the routes.php files.
🚀 Usage
Use the Lang::uri() macro when registering routes:
The URI macro accepts 2 additional parameters:
- A locale, in case you need translations to a locale other than the current app locale.
- A namespace, in case your translation files reside in a package.
You can also use trans()->uri('hello/world') instead of Lang::uri('hello/world').
🔌 Example
Using these example translations:
These are possible translation results:
🚧 Testing
☕️ Credits
🔒 Security
If you discover any security related issues, please e-mail me instead of using the issue tracker.
📑 Changelog
A complete list of all notable changes to this package can be found on the releases page.
📜 License
The MIT License (MIT). Please see License File for more information.