fordnox / php-json-api
Simple JSON API Builder for PHP
dev-master
2014-08-30 10:00 UTC
Requires
- php: >=5.3.0
Requires (Dev)
- phpunit/phpunit: 4.1.1
This package is not auto-updated.
Last update: 2024-11-18 14:59:50 UTC
README
php-json-api
Most simple JSON API builder class for PHP. One file only. Accepting a JSON request body and returning JSON as a result.
Example Server
<?php require __DIR__ . '/../vendor/autoload.php'; $server = new Fordnox\JsonApiServer(); $server->register('ping', function($params){ return $params; }); $server->handle();
Example Invoke
curl http://api.com -d '{"method":"ping","params":"pong!"}' {"result":"pong!", "error":null}