1. Go to this page and download the library: Download osushi/apidoc library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
osushi / apidoc example snippets
Osushi\Apidoc\Apidoc;
use Osushi\Apidoc\Permission;
use Osushi\Apidoc\Parameter;
use Osushi\Apidoc\Request;
use Osushi\Apidoc\Response;
Apidoc::init();
$apiDoc = Apidoc::getInstance();
$permission = new Permission();
$permission->add('users:*');
$permission->add('users:get');
$parameter = new Parameter();
$parameter->add('name', ['isa' => 'string', 't
);
$request = new Request([
'method' => 'GET',
'path' => '/users',
'parameters' => ['status' => 10, 'name' => 'tarou'],
'headers' => ['Content-Type' => 'application/json'],
]);
$response = new Response([
'code' => 200,
'headers' => ['Content-Type' => 'application/json; charset=utf-8'],
'body' => '{"id": 1,"name": "tarou","status": 10,"created_at": "2015-04-21T14:55:09.351Z","updated_at": "2015-04-21T14:55:09.351Z"}',
]);
$documents->example(
'users:/users:GET', # This key format is {filename}:{path}:{method}
$request,
$response,
'200 Success' # It's able to add comment
);
$apiDoc->render();