Zaphpa = APIs for PHP
require_once('./vendor/autoload.php');
$router = new \Zaphpa\Router();
$router->attach('\Zaphpa\Middleware\AutoDocumentator', '/apidocs'); //auto-docs middleware
$router->attach('\Zaphpa\Middleware\MethodOverride');
$router->attach('\Zaphpa\CORS');
$router->addRoute(array(
'path' => '/users/{id}',
'get' => array('\MyAwesomeApp\UserController', 'getUser'),
'post' => array('\MyAwesomeApp\UserController', 'updateUser'),
));
$router->route();
Zaphpa, pronounced as the last name of Frank Zappa, is a routing microkernel inspired by Sinatra.rb, and implemented in PHP (hence the extra geeky "h" in the name creating the sub-pattern of: "php").
Zaphpa is a lightweight library that excels at single mission: free PHP API developers from the boilerplate of handling HTTP requests and implementing REST.
You can think of it as an equivalent of Sinatra (in Ruby) or Express.js (in Javascript) frameworks for PHP, if you will.
Zaphpa is actively used by NPR's software teams in the Digital Media and Digital Services divisions, benefiting from thorough bug-fixing and various contributions by: @inadarei, @karoun, @randallsquared, @johnymonster, @jsgrosman and @d1b1.