This package is abandoned and no longer maintained. No replacement package was suggested.

Negotiation Service Provider for Silex

1.0.4 2016-06-05 14:18 UTC

This package is auto-updated.

Last update: 2022-02-01 12:27:10 UTC


A Negotiation service provider for Silex.


This project is DEPRECATED and should NOT be used.

If someone magically appears and wants to maintain this project, I'll gladly give access to this repository.


Initialize the service provider using register() method:


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/', 'application/'),

Then use it in your controllers:


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

    // do your stuff


The service provider creates the following services:

  • negotiator: a Negotiator instance ;
  • format.negotiator: a FormatNegotiator instance ;
  • language.negotiator: a LanguageNegotiator instance.


Install the NegotiationServiceProvider adding kphoen/negotiation-service-provider to your composer.json or from CLI:

$ php composer.phar require 'kphoen/negotiation-service-provider:~1.0'


This provider is released under the MIT license.