PHP code example of kphoen / negotiation-service-provider

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

    

kphoen / negotiation-service-provider example snippets




use KPhoen\Provider\NegotiationServiceProvider;

$app->register(new NegotiationServiceProvider());
// or with custom formats, which will be injected in the format negotiator and
// in the request
$app->register(new NegotiationServiceProvider(array(
    'gpx' => array('application/gpx+xml'),
    'kml' => array('application/vnd.google-earth.kml+xml', 'application/vnd.google-earth.kmz'),
)));



$app->get('/hello', function() use ($app) {
    $negotiator = $app['negotiator'];

    // do your stuff
});

$ php composer.phar