library php-json-api
Simple JSON API Builder for PHP
fordnox/php-json-api
Simple JSON API Builder for PHP
- Saturday, August 30, 2014
- by fordnox
- Repository
- 1 Watchers
- 0 Stars
- 4 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 1 Versions
- 0 % Grown
, (*1)
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., (*2)
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}