use Kanboard\Api\Category; use Kanboard\Api\Comment; use Kanboard\Api\File; use Kanboard\Api\Link; use Kanboard\Api\Project; use Kanboard\Api\ProjectPermission; use Kanboard\Api\Subtask; use Kanboard\Api\Swimlane; use Kanboard\Api\Task; use Kanboard\Api\TaskLink; use Kanboard\Api\User; use Kanboard\Api\Group; use Kanboard\Api\GroupMember; $server = new Server(); $server->setAuthenticationHeader(API_AUTHENTICATION_HEADER); $server->before(array(new Auth($container), 'checkCredentials')); $server->attach(new Me($container)); $server->attach(new Action($container)); $server->attach(new App($container)); $server->attach(new Board($container)); $server->attach(new Column($container)); $server->attach(new Category($container)); $server->attach(new Comment($container)); $server->attach(new File($container)); $server->attach(new Link($container)); $server->attach(new Project($container)); $server->attach(new ProjectPermission($container)); $server->attach(new Subtask($container)); $server->attach(new Swimlane($container)); $server->attach(new Task($container)); $server->attach(new TaskLink($container));
<?php require "JsonRPC/src/JsonRPC/Server.php"; use JsonRPC\Server; use JsonRPC\AuthenticationFailure; function beforeProcedure($username, $password, $class, $method) { if ($login_condition_failed) { throw new AuthenticationFailure('Wrong credentials!'); } } $server = new Server(); $server->authentication(['testuser' => 'testpass']); // Register the before callback $server->before('beforeProcedure'); // Procedures registration $server->register('addition', function ($a, $b) { return $a + $b; }); $server->register('random', function ($start, $end) { return mt_rand($start, $end); }); $server->register('hello', function () { return 'world'; }); // Return the response to the client echo $server->execute();