1. Go to this page and download the library: Download usox/language-negotiator 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/ */
usox / language-negotiator example snippets
use Usox\LanguageNegotiator\LanguageNegotiator;
$negotiator = new LanguageNegotiator(
['en', 'de'], // array of supported languages
'en' // fallback language,
$_SERVER
);
$clientLanguage = $negotiator->negotiate();
use Usox\LanguageNegotiator\LanguageNegotiator;
$negotiator = new LanguageNegotiator(
['en', 'de'], // array of supported languages
'en' // fallback language,
);
$clientLanguage = $negotiator->negotiate(
$_SERVER
);
use Usox\LanguageNegotiator\LanguageNegotiator;
$negotiator = new LanguageNegotiator(
['en', 'de'], // array of supported languages
'en' // fallback language,
);
// assumes, you have some kind of framework which supports PSR request handling
$myFramework->addMiddleware($negotiator);
// get the language from the psr server request
$clientLanguage = $request->getAttribute(LanguageNegotiator::REQUEST_ATTRIBUTE_NAME);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.