PHP code example of syonix / http-header-accept-language

1. Go to this page and download the library: Download syonix/http-header-accept-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/ */

    

syonix / http-header-accept-language example snippets


use Syonix\Http\Header\AcceptLanguage\AcceptLanguage;

$parsed = AcceptLanguage::parse('da, en-gb;q=0.8, en;q=0.7'); // Returns Array ordered by quality (q)
$parsed = AcceptLanguage::match('de-CH, de-DE;q=0.9, de;q=0.8', ['de-DE', 'de']); // Returns 'de-DE'