Voting starts in March for the Drupal Association Board election.
This is just so we can track the status of this library, which will be a PHP project outside of Drupal, for all to use, likely a part of Symfony. This is where we will figure out where to contribute. We can't contribute directly to Drupal.org because of licensing issues.
Per today's WSCCI IRC meeting:
11:38 <@Crell> What we'll want to do is be able to pull the accept header out of the request object, pass it to some library, and get back "so this is the mime type, version, and language you want to use. Trust me on this."
Thanks to the alphabet, you can see the spec for these headers at the top of this page: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
The benevolent lsmith77 is in need of a similar thing here:
which is all about re-implementing what Apache can do so that we have more say in it, and what Apache does is here:
We are interested in solving this in a general PHP library scope, which to me means something like taking a bastard string like this:
image/gif, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, application/x-silverlight-2-b2, application/x-silverlight, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
and parsing that into an ordered hash of some sort so we know what it wants, by way of MIME types in this example. So, we need a way of supplying on the server side an index of types, languages, encoding and (I guess) charset that we support for the given resource (system path), we initialize our Negotiator with that, and it comes back with what we're going to serve up. Then this library is done, and we get to decorate the request object, and pass that on.
There are quite a few libraries for doing content negotiation in PHP:
- https://github.com/winmillwill/BadFaith initiated by @wamilton but seeking someone to continue the work
- http://ptlis.net/source/php/content-negotiation/ it's an old library, see its pros/cons in #6)
- https://github.com/ramsey/mimeparse (supports MIME types only)
- FLOW3 content negotiation implementation which was committed a few months ago
- https://github.com/FriendsOfSymfony/FOSRest/tree/master/Util (partial implementation by @lsmith)
- https://github.com/codeguy/Slim/pull/376 (includes tests)
- https://github.com/symfony/symfony/pull/5711 is a proof of concept content negotiation library which may become part of Symfony (see expression of interested by Fabien Potencier)