2017 © Pedro Peláez
 

library zf2-acyaml

A Zend Framework 2 module to render yaml responses

image

acelaya/zf2-acyaml

A Zend Framework 2 module to render yaml responses

  • Saturday, February 28, 2015
  • by acelaya
  • Repository
  • 1 Watchers
  • 2 Stars
  • 639 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

AcYaml

Build Status Code Coverage Scrutinizer Code Quality Latest Stable Version Total Downloads License, (*1)

This module allows to work with Yaml responses the same way we do with JSON responses. Indeed, this module is pretty simple and is based on built-in JSON rendering classes (View\JsonStrategy, View\JsonRenderer and View\JsonModel) but using Symfony\Yaml instead of Zend\Json., (*2)

Installation

The only supported installation method is composer, however others could work too., (*3)

Get composer binary into your project., (*4)

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

And run this command in order to get this module installed., (*5)

php composer.phar require acelaya/zf2-acyaml:~0.1

Finally add the module to your application.config.php file., (*6)

return array(
    'modules' => array(
        'Application',
        'Acelaya\Yaml' // <- Add this line
    )
);

Usage

The module will register a yaml view rendering strategy, so any action returning a YamlModel (which is very similar to the JsonModel) will make the response to be in yaml format, including the Content-type header with value application/x-yaml., (*7)

And that's it. No further configuration is needed. Nice and easy., (*8)

The Versions