zf-fr/ZfrRest — pull request #16 by bakura10 (2013-01-15 23:15:14+00:00)
Title: Add parsing of Body

This adds lot of things that will be useful for much of the work on the module:

1. Adds the dependency to Symfony\Serializer component. For now, it only supports XML and Json. If we need more format, we could either adds a dependency to JMSSerializer instead, but people can add their own encoder/decoder directly through the config file:

```php
'zfr_rest' => array(
'serializer' => array(
'encoders' => array(
'json' => 'Symfony\Component\Serializer\Encoder\JsonEncoder',
'xml' => 'Symfony\Component\Serializer\Encoder\XmlEncoder'
),

'normalizers' => array()
)
)
```

2. Adds a new ZfrRest\Mime\FormatDecoder component. This allows to convert a MIME-Type to a format (html, xml, json...). I will convert my own code to use this one. There is an initializer so that any class implemeting ZfrRest\Mime\FormatDecoderAwareInterface, the FormatDecoder will be injected.

To add new matches (format to mime-type), you can do it through the config of the module:

```php
'format_decoder' => array(
'matches' => array(
'html' => array('text/x-handlebars')
)
),
```

Note that a specific mime-type can be matched to only one format (I think it makes sense @ocramius no ?). The FormatDecoder comes with some basic format => $mimeTypes, but you can override them through the config too.

3. Adds Parser in ZfrRest\Http. Currently, there is only one Body parser that parses the content of the request.

If the architecture is ok for you ocramius, I'll write tests :).