2017 © Pedro Peláez
 

library apigility-xml-negotiation

Apigility Module providing XML content-negotiation features

image

diegograssato/apigility-xml-negotiation

Apigility Module providing XML content-negotiation features

  • Sunday, March 12, 2017
  • by diego.grassato
  • Repository
  • 1 Watchers
  • 1 Stars
  • 209 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 155 % Grown

The README.md

apigility-xml-negotiation

Apigility Module providing XML content-negotiation features, (*1)


This module is inspired from abandoned ApigilityXml project for Markus!

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": {
        "diegograssato/apigility-xml-negotiation" : "dev-master"
    }
}

Finally install dependencies, (*6)

php composer.phar install

or update it, (*7)

php composer.phar update

Usage

  • Add ZF\ContentNegotiation\XML to modules.config.php:
    return array(
        ...,
        'ZF\ContentNegotiation\XML',
        ....
    )     
  • 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

The Versions