ConNeg
A Content Negotiation library for PHP >= 5.3. The API provides support for negotiation on the Accept, Accept-Charset, Accept-Encoding and Accept-Language fields in a HTTP header.
Install
Either from the console:
$ composer require ptlis/conneg:~3.0.0
Or by Editing composer.json:
{
"require": {
...
"ptlis/conneg": "~3.0.0",
...
}
}
Followed by a composer update:
$ composer update
Use negotiator:
use ptlis\ConNeg\Negotiate;
Documentation
Integration
- PSR-7 via the ptlis/psr7-conneg library.
- Symfony2 via the ptlis/conneg-bundle Bundle.
Contributing
You can contribute by submitting an Issue to the issue tracker, improving the documentation, integrating the library into your framework of choice or submitting a pull request. For pull requests i'd prefer that the code style and test coverage is maintained, but I am happy to work through any minor issues that may arise so that the request can be merged.
TODO
- Handle accept-extens
- Time based negotiation? See RFC 7089