https://github.com/k-phoen/negotiationserviceprovider
[DEPRECATED] Negotiation Service Provider for Silex
https://github.com/k-phoen/negotiationserviceprovider
Last synced: about 1 month ago
JSON representation
[DEPRECATED] Negotiation Service Provider for Silex
- Host: GitHub
- URL: https://github.com/k-phoen/negotiationserviceprovider
- Owner: K-Phoen
- License: mit
- Created: 2013-09-13T15:49:03.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2016-06-05T14:18:26.000Z (over 9 years ago)
- Last Synced: 2024-08-16T21:15:26.308Z (about 1 year ago)
- Language: PHP
- Homepage: http://k-phoen.github.io/NegotiationServiceProvider/
- Size: 9.77 KB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
NegotiationServiceProvider [](https://travis-ci.org/K-Phoen/NegotiationServiceProvider)
==========================A [Negotiation](https://github.com/willdurand/Negotiation/) service provider for [Silex](http://silex.sensiolabs.org/).
## Status
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.
## Usage
Initialize the service provider using `register()` method:
```php
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'),
)));
```Then use it in your controllers:
```php
get('/hello', function() use ($app) {
$negotiator = $app['negotiator'];// do your stuff
});
```## Configuration
The service provider creates the following services:
* `negotiator`: a Negotiator instance ;
* `format.negotiator`: a FormatNegotiator instance ;
* `language.negotiator`: a LanguageNegotiator instance.## Installation
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'
```## Licence
This provider is released under the MIT license.