PHP code example of lambdadigamma / laravel-api-language
1. Go to this page and download the library: Download lambdadigamma/laravel-api-language 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/ */
lambdadigamma / laravel-api-language example snippets
use Lambdadigamma\LaravelApiLanguage\LanguageNegotiator;
$result = app(LanguageNegotiator::class)->negotiate($request);
$result->acceptedLocales; // ordered positive locales, including positive * and excluding q=0
$result->excludedLocales; // q=0 locales, including *
$result->resolvedLocale; // best supported application locale
$result->resolvedLocaleIsAcceptable; // false when every supported locale is excluded