Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/diegograssato/apigility-yaml-negotiation

Apigility Module providing YAML/YML/TXT content-negotiation features
https://github.com/diegograssato/apigility-yaml-negotiation

Last synced: 23 days ago
JSON representation

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

Awesome Lists containing this project

README

        

apigility-yaml-negotiation
=========================

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:

```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