apigility-xmlnegotiation
XML negotiation module for Apigility, (*1)
Necessary infrastructure to handle XML with ZF Apigility with HAL structure., (*2)
Response type is based on Accept header :, (*3)
- request that specifies application/xml (or application/*+xml) get the content in XML
-
application/hal+json (or application/*+json) request get the content in HalJson as usual.
Installation
Install composer in your project, (*4)
curl -s http://getcomposer.org/installer | php
Define dependencies in your composer.json file, (*5)
{
"require": {
"zpetr/apigility-xmlnegotiation" : "1.*"
}
}
Finally install dependencies, (*6)
php composer.phar install
or update it, (*7)
php composer.phar update
Usage
- Add zPetr\ApigilityXml to config/modules.config.php:
return array(
...,
'zPetr\ApigilityXml',
....
)
- Go to admin, select your API and change Content Negotiation Selector to HalJsonXML
- Add application/xml to Accept whitelist and Content-Type whitelist. Add other headers if needed.
- Save configuration