mvccore / ext-router-media-localization
MvcCore - Extension - Router - Media & Localization - extension 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), optionaly contained in url address in the beinning.
Requires
- php: >=5.4.0
- mvccore/ext-router-extended: ^5.2
- mvccore/ext-router-localization: ^5.2
- mvccore/ext-router-media: ^5.2
- mvccore/mvccore: ^5.2
README
MvcCore Router extension to manage website media version (full/tablet/mobile) for different templates/css/js files rendering and to manage your website language (or language and locale) version optionaly contained in url address in the beinning.
This extension is mix of 2 extended router extensions:
This extension does the same things as extensions above together.
Installation
composer require mvccore/ext-router-media-localization
Features
Extension has the same features as extensions bellow together:
In URL addresses is always contained media site prefix first (before localization prefix) like this - example:
- Full address for (default) locale
en-US
: `/en-US/any/path/with?query=string - Mobile address for different locale
en-US
: `/m/de-DE/ein/route/mit?abfragezeichen=folge
How It Works
Extension works in the same way as extensions named above, each task is executed
like for media extension first, then like for localization extension as second:
Only routing is implemented explicitly (it means method Route()
in this router) and processing redirections and completing url addresses is implemented explicitly - to complete the proper URL string together with both query string values or with both prefixes.
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\MediaAndLocalization'); ... // to get router instance for next configuration: /** @var \MvcCore\Ext\Routers\MediaAndLocalization $router */ $router = \MvcCore\Router::GetInstance();
All other specific usage and advanced configuration is the same as extensions bellow together: