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.

v5.2.0 2023-12-12 13:07 UTC

This package is auto-updated.

Last update: 2024-04-12 13:57:56 UTC


README

Latest Stable Version License PHP Version

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: