2017 © Pedro PelĂĄez
 

library api-server

API Server with PHP and MongoDB

image

crodas/api-server

API Server with PHP and MongoDB

  • Sunday, April 3, 2016
  • by crodas
  • Repository
  • 2 Watchers
  • 0 Stars
  • 51 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

ApiServer

Deadly simple API ”Server., (*1)

It was designed for Javascript clients:, (*2)

  1. Speaks JSON out of the box
  2. API calls are buffered for 50ms waiting for other requests to join
    1. The less we talk to the server the better.
  3. The server is implemented from scratch keeping easy of use in mind:
    1. API handlers are PHP functions or methods which are discovered with annotations
    2. Everything is compiled for speed.

How to use it

The bootstrap code (index.php) should look like this:, (*3)

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

$api = new crodas\ApiServer(
    __DIR__ . '/src/services' // my apis
);

$api->main();
/** @API array_sum */
function do_array_sum($args, $server) {
    return array('array_sum' => array_sum($args));
}

A client is included in client/dist (You can build the source with bower install; gulp dist)., (*4)

Server.setUrl("http://api.foobar.com");
Server.exec("array_sum", [1,2,3]).then(function(result) {
    console.error(result);
});
Server.exec("array_sum", [2,3]).then(function(result) {
    console.error(result);
});

The Versions

03/04 2016

dev-develop

dev-develop

API Server with PHP and MongoDB

  Sources   Download

MIT

The Requires

 

by Cesar Rodas

01/04 2016

dev-analysis-8L3JRG

dev-analysis-8L3JRG

API Server with PHP and MongoDB

  Sources   Download

MIT

The Requires

 

by Cesar Rodas

21/03 2016

dev-master

9999999-dev

API Server with PHP and MongoDB

  Sources   Download

MIT

The Requires

 

by Cesar Rodas

21/03 2016

v0.1.2

0.1.2.0

API Server with PHP and MongoDB

  Sources   Download

MIT

The Requires

 

by Cesar Rodas

20/03 2016

v0.1.1

0.1.1.0

API Server with PHP and MongoDB

  Sources   Download

MIT

The Requires

 

by Cesar Rodas