kumatch/silex-json-body-provider

A Silex service provider for JSON body parsing.

0.1.0 2014-12-08 14:59 UTC

This package is not auto-updated.

Last update: 2024-05-07 02:02:29 UTC


README

A Silex service provider for JSON body parsing. See silex cookbook. http://silex.sensiolabs.org/doc/cookbook/json_request_body.html

Build Status

Install

$ composer require kumatch/silex-json-body-provider

Example

<?php

use Silex\Application;
use Kumatch\Silex\JsonBodyProvider;

$app = new Application();
$app->register(new JsonBodyProvider());

// ex. post JSON '{"value":42}'
$app->post("/", function (Request $req) {
    $value = $req->request->get("value");  // 42
});

License

Licensed under the MIT License.