mvccore / ext-router-module-media-localization
MvcCore - Extension - Router - Modules With Media & Localization - extension to manage multiple websites in a single project, to manage website media versions (full/tablet/mobile) for different templates/CSS/JS files rendering and to manage website localizations (language or language and locale), op
Requires
- php: >=5.4.0
- mvccore/ext-router-extended: ^5.3
- mvccore/ext-router-localization: ^5.3
- mvccore/ext-router-media: ^5.3
- mvccore/ext-router-media-localization: ^5.3
- mvccore/ext-router-module: ^5.3
- mvccore/ext-router-module-localization: ^5.3
- mvccore/mvccore: ^5.3
README
MvcCore Router extension to manage multiple websites in single project, to manage website media versions website media versions (full
/tablet
/mobile
for different templates/css/js files rendering, optionaly contained in URL address domain part or in URL address beinning) and to manage website localizations (language or language and locale, optionaly contained in URL address domain part or in URL address beinning), defined by domain routes, targeted by module property in URL completing.
This router is the way, how to route your requests in domain level with website media versions and localizations with params or variable sections, namespaces, default param values and more.
Outline
1. Installation
composer require mvccore/ext-router-module-media-localization
2. Features
Extension has the same features as extensions bellow together:
- Features for
mvccore/ext-router-module
- Features for
mvccore/ext-router-media
- Features for
mvccore/ext-router-localization
Website media version and localization could be contained in any module domain route as params named <media_version>
and/or <localization>
match URL requests like this:
http://en-US.example.com/anything
http://de-DE.example.com/etwas
http://mobile.en-US.example.com/anything
http://mobile.de-DE.example.com/etwas
new \MvcCore\Ext\Routers\Modules\Route([ "pattern" => "//[<media_version>.]<localization>.example.com", "module" => "main", "constraints" => ["media_version" => "www|mobile", "localization" => "-a-zA-Z0-9"], ]);
If there is not contained param <media_version>
and/or <localization>
in matched module domain route pattern, website media version and/or localization param has to be contained (or is automaticly inserted) in URL address beginning like this:
http://www.example.com/en-US/anything
http://www.example.com/mobile/en-US/anything
http://www.example.com/de-DE/etwas
http://www.example.com/mobile/de-DE/etwas
How precisely is conained in URL address depends on advanced router configuration like allowed media version and more...
3. How It Works
Extension works in the same way as extensions bellow together:
- How It Works -
mvccore/ext-router-module
- How It Works -
mvccore/ext-router-media
- How It Works -
mvccore/ext-router-localization
Router is composed from traits in extensions named above.
4. Usage
Usage - Bootstrap
Initialization
Add this to /App/Bootstrap.php
or to very application beginning,
before application routing or any other extension configuration
using router for any purposes:
$app = \MvcCore\Application::GetInstance(); $app->SetRouterClass('\MvcCore\Ext\Routers\ModuleMediaAndLocalization'); ... // to get router instance for next configuration: /** @var \MvcCore\Ext\Routers\ModuleMediaAndLocalization $router */ $router = \MvcCore\Router::GetInstance();
All other specific usage and advanced configuration is the same as extensions bellow together: