koseduhemak / zf3-locale-router
Setup language-aware routes in Zend Framework 3 applications like f.e. www.example.com/de/my/uri for German or www.example.com/en/my/uri for English.
Installs: 246
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 2
Open Issues: 0
pkg:composer/koseduhemak/zf3-locale-router
Requires
- php: ^7.1 || ^7.2 || ^7.3 || ^7.4
- ext-intl: *
- laminas/laminas-dependency-plugin: ^1.0
- laminas/laminas-eventmanager: ^3.0
- laminas/laminas-http: ^2.7
- laminas/laminas-modulemanager: ^2.8
- laminas/laminas-mvc: ^2.7.10 || ^3.0
- laminas/laminas-mvc-i18n: ^1.0
- laminas/laminas-router: ^3.0
- laminas/laminas-servicemanager: ^3.1
- laminas/laminas-stdlib: ^3.1
Requires (Dev)
- doctrine/doctrine-orm-module: ^1.1 || ^2.1
- doctrine/orm: ^2.5 || ^2.6
- friendsofphp/php-cs-fixer: ^2.9
- laminas/laminas-authentication: ^2.5
- phpunit/phpunit: ^9
- satooshi/php-coveralls: ^2.0
README
This module is intended to implement URIs like http://www.example.com/de/path/path2 or http://www.example.com/en/path/path2 in your ZF3 application.
To achieve this, multiple strategies can be used to extract the best suited locale for a user (and redirect him to the correct uri). This is f.e. necessary for SEO.
If you need to extract the current locale, you can use \Locale::getDefault(); to return the current set locale (f.e. de_DE).
The strategies are processed in the order you configured them and is stopped as soon as the locale could be extracted.
Thanks to the creators of the modules https://github.com/basz/SlmLocale and https://github.com/xelax90/zf2-language-route, from which I took a little bit inspiration from.
If you like my module, you can buy me a beer or some coffee: https://www.paypal.me/koseduhemak
Installation
Install via composer:
$ composer require koseduhemak/zf3-locale-router
Usage
Read more about configuration options and different extracting / persisting strategies: configuration manual.
Buy me a beer / coffee
If you like my module, you can buy me a beer or some coffee: https://www.paypal.me/koseduhemak