1. Go to this page and download the library: Download mvccore/ext-router-media library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mvccore / ext-router-media example snippets
$app = \MvcCore\Application::GetInstance();
$app->SetRouterClass('\MvcCore\Ext\Routers\Media');
...
// to get router instance for next configuration:
/** @var \MvcCore\Ext\Routers\Media $router */
$router = \MvcCore\Router::GetInstance();
// to allow only mobile version (with url prefix '/mobile')
// and full version (with no url prefix):
use \MvcCore\Ext\Routers;
...
// now, tablet version is not allowed:
$router->SetAllowedMediaVersionsAndUrlValues([
Routers\Media::MEDIA_VERSION_MOBILE => 'mobile',
// if you are using an empty string url prefix for full version,
// you need to define it as the last item!
Routers\Media::MEDIA_VERSION_FULL => '',
]);