2017 © Pedro Peláez
 

library server

JSON server

image

jsonful/server

JSON server

  • Friday, May 5, 2017
  • by crodas
  • Repository
  • 5 Watchers
  • 13 Stars
  • 307 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 5 Versions
  • 1 % Grown

The README.md

JSONful

JSONful is a framework which helps creating API servers., (*1)

Features

  1. Ease of use
    • It exposes regular PHP functions to the API, making it easy to integrate with any other framework and existing code.
    • It is easy to make cross domain requests ($server['public'] = true;)
    • The javascript client works out of the box and it's optimized for performance
    • The client concatenates many requests and sending it in a single HTTP request.
    • It has no dependency, and it can be used with WebPack or directly.

Installation

composer require jsonful/server

Usage

api.php

require __DIR__ . '/vendor/autoload.php';

$server new JSONful\Server(__DIR__ . '/apps');
$server->run();

apps/prime.php

/** @API("prime") */
function is_prime($number)
{
    if ($number <= 0) {
        return false;
    }
    $middle = ceil($number/2);
    for ($i = 2; $i <= $middle; ++$i) {
        if ($number % $i === 0) {
            return false;
        }
    }
    return true;
}

/** @API("ping") */
function ping() {
    return ['pong' => time()];
}

client.js

var client = new JSONful("https://api.myapp.net/");

client.exec("ping", function(err, response) {
  console.log(response); // {"pong": xxxx}
}
client.exec("prime", 99).then(function(response) {
  console.error(response); // false
});

The Versions

05/05 2017

dev-develop

dev-develop

JSON server

  Sources   Download

MIT

The Requires

 

The Development Requires

by Cesar Rodas

11/11 2016

dev-master

9999999-dev

JSON server

  Sources   Download

MIT

The Requires

 

by Cesar Rodas

11/11 2016

v0.1.3

0.1.3.0

JSON server

  Sources   Download

MIT

The Requires

 

by Cesar Rodas

27/04 2016

v0.1.2

0.1.2.0

JSON server

  Sources   Download

MIT

The Requires

 

by Cesar Rodas

21/04 2016

v0.1.1

0.1.1.0

JSON server

  Sources   Download

MIT

The Requires

 

by Cesar Rodas