PHP code example of proteins / negotiation

1. Go to this page and download the library: Download proteins/negotiation 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/ */

    

proteins / negotiation example snippets


use Proteins\Negotiation;

$need  = 'image/*;q=0.9,*/*;q=0.2';
$offer = 'text/html,svg/xml,image/svg+xml';
echo Negotiation::bestMatch($need,$offer);

$negotiatior = new Negotiation('en-US;q=0.3,it,en;q=0.4,es;q=0.9,de');

echo $negotiatior->preferred();

echo $negotiatior->best('es,en-US');