diegograssato/apigility-yaml-negotiation

Apigility Module providing YAML/YML/TXT content-negotiation features

v1.0 2017-03-12 02:18 UTC

This package is auto-updated.

Last update: 2024-11-28 14:57:12 UTC


README

YamlNegotiation module for Apigility.

Response type is based on Accept header :

  • request that specifies text/yaml (or text/yml) get the content in YAML
  • application/hal+json (or application/*+json) request get the content in HalJson as usual.

Installation

Install composer in your project

curl -s http://getcomposer.org/installer | php

Add dependency in composer.json.

composer require diegograssato/apigility-yaml-negotiation

Usage

  • Add ZF\ContentNegotiation\YAML to application.config.php:
return [
    'modules' => [
        ...
        'ZF\\ContentNegotiation\\YAML',
        ....
    ]
]    
  • Go to admin, select your API and change Content Negotiation Selector to HalJsonYAML
  • Add text/yaml to Accept whitelist and Content-Type whitelist. Add other headers if needed.
  • Save configuration