Download the PHP package opgginc/codezero-laravel-uri-translator without Composer
On this page you can find all versions of the php package opgginc/codezero-laravel-uri-translator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package codezero-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.
✅ Requirements
- PHP >= 8.1 (supports up to 8.4)
- Laravel >= 10.0 (supports up to 12.0)
📦 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
- Ivan Vermeyen (Original Author) - Rest in Peace
- OPGG Inc. Team
- All 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
This project is maintained by OP.GG Inc. If you discover any security related issues, please use the issue tracker.
📑 Changelog
This package is a fork of codezero/laravel-uri-translator, updated to support Laravel 12 and PHP 8.4.
📜 License
The MIT License (MIT). Please see License File for more information.