2017 © Pedro Peláez
 

library responsible-service-provider

A Silex ServiceProvider for automagic response formatting.

image

tobiassjosten/responsible-service-provider

A Silex ServiceProvider for automagic response formatting.

  • Friday, September 23, 2016
  • by tobiassjosten
  • Repository
  • 4 Watchers
  • 35 Stars
  • 22,589 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 0 Open issues
  • 3 Versions
  • 9 % Grown

The README.md

ResponsibleServiceProvider

A Silex ServiceProvider for automagic response formatting., (*1)

Build Status, (*2)

Installation

1) Add the package to you composer.json:, (*3)

$ composer require tobiassjosten/responsible-service-provider

(For Silex 1, add the 0.0.1 version to the end of that commend.), (*4)

2) Register it in your application., (*5)

$app->register(new \Tobiassjosten\Silex\ResponsibleServiceProvider());

Usage

Once enabled, just have your controllers return data as an array. ResponsibleServiceProvider will do the rest., (*6)

$app->get('/foo', function () {
    return ['Bar'];
});

In JSON:, (*7)

$ curl -I -H 'Accept: application/json' http://example.com/foo
HTTP/1.1 200 OK
Date: Tue, 07 May 2013 08:30:58 GMT
Server: Apache/2.2.22 (Ubuntu)
X-Powered-By: PHP/5.4.9-4ubuntu2
Cache-Control: no-cache
Transfer-Encoding: chunked
Content-Type: application/json

["Bar"]

And in XML:, (*8)

$ curl -I -H 'Accept: application/xml' http://example.com/foo
HTTP/1.1 200 OK
Date: Tue, 07 May 2013 08:30:58 GMT
Server: Apache/2.2.22 (Ubuntu)
X-Powered-By: PHP/5.4.9-4ubuntu2
Cache-Control: no-cache
Transfer-Encoding: chunked
Content-Type: application/xml

<?xml version="1.0"?>
<response><item key="0">Bar</item></response>

The Versions

23/09 2016

dev-master

9999999-dev

A Silex ServiceProvider for automagic response formatting.

  Sources   Download

MIT

The Requires

 

The Development Requires

silex service-provider

22/09 2016

1.0.0

1.0.0.0

A Silex ServiceProvider for automagic response formatting.

  Sources   Download

MIT

The Requires

 

The Development Requires

silex service-provider

29/08 2016

0.0.1

0.0.1.0

A Silex ServiceProvider for automagic response formatting.

  Sources   Download

MIT

The Requires

 

The Development Requires

silex service-provider