PHP code example of elife / content-negotiator
1. Go to this page and download the library: Download elife/content-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/ */
elife / content-negotiator example snippets
use eLife\ContentNegotiator\Silex\ContentNegotiationProvider;
use Negotiation\Accept;
$app->register(new ContentNegotiationProvider());
$app->get('/path', function (Accept $accept) {
return new Response("Negotiated {$accept->getNormalizedValue()}");
})->before($app['negotiate.accept']('text/plain', 'text/rtf'));