Download the PHP package tobiassjosten/responsible-service-provider without Composer
On this page you can find all versions of the php package tobiassjosten/responsible-service-provider. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download tobiassjosten/responsible-service-provider
More information about tobiassjosten/responsible-service-provider
Files in tobiassjosten/responsible-service-provider
Download tobiassjosten/responsible-service-provider
More information about tobiassjosten/responsible-service-provider
Files in tobiassjosten/responsible-service-provider
Vendor tobiassjosten
Package responsible-service-provider
Short Description A Silex ServiceProvider for automagic response formatting.
License MIT
Package responsible-service-provider
Short Description A Silex ServiceProvider for automagic response formatting.
License MIT
Keywords silexservice-provider
Please rate this library. Is it a good library?
Informations about the package responsible-service-provider
ResponsibleServiceProvider
A Silex ServiceProvider for automagic response formatting.
Installation
1) Add the package to you composer.json:
$ composer require tobiassjosten/responsible-service-provider
(For Silex 1, add the 0.0.1 version to the end of that commend.)
2) Register it in your application.
$app->register(new \Tobiassjosten\Silex\ResponsibleServiceProvider());
Usage
Once enabled, just have your controllers return data as an array. ResponsibleServiceProvider will do the rest.
$app->get('/foo', function () {
return ['Bar'];
});
In JSON:
$ 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:
$ 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>All versions of responsible-service-provider with dependencies
PHP Build Version
Package Version
The package tobiassjosten/responsible-service-provider contains the following files
Loading the files please wait ...
