PHP code example of lefuturiste / slim3_multilanguage
1. Go to this page and download the library: Download lefuturiste/slim3_multilanguage 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/ */
lefuturiste / slim3_multilanguage example snippets
//Application router
$container = $app->getContainer();
$container['view'] = function ($container){
$dir = dirname(__DIR__);
$view = new \Slim\Views\Twig($dir . '/App/views', [
'cache' => false
]);
return $view;
};
//This parameter must be is instance of TWIG Environment! /!\ (no ilableLang,
'defaultLang' => $defaultLang,
'twig' => $twigEnvironment,
'container' => $container
]));
$app->get('/no-page-multilanguage-support', 'CALLED FONCTION');
$app->group('/{lang:[a-z]{2}}', function () use ($container){
//route for /{lang}
$this->get('', 'CALLED FONCTION')->setName('home');
//route for /{lang}/contact
$this->get('/contact', 'CALLED FONCTION')->setName('contact');
});
$app->run();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.