Smalldb-REST
v0.5-5-gff393ee
|
The REST API application.
Simply call Application::main(__DIR__)
and it should work.
$base_dir | Base directory, where config.app.json.php is located. |
$task | Select what this PHP script shall do – see TASK_* constants. |
Static Public Member Functions | |
static | initialize ($base_dir) |
Initialize environment. More... | |
static | main ($base_dir, $task=self::TASK_API) |
The main() More... | |
static | renderStateMachine (\Smalldb::StateMachine::AbstractBackend $smalldb, $machine, $format) |
Render state diagram. More... | |
static | performSelfCheck (\Smalldb::StateMachine::AbstractBackend $smalldb) |
Perform self-check. More... | |
Public Attributes | |
const | TASK_INIT = 'init' |
Initialization only (for custom scripts) More... | |
const | TASK_API = 'api' |
Implement Smalldb JSON REST API. More... | |
const | TASK_DIAGRAM = 'diagram' |
State diagram renderer ($_GET params: machine, format (dot, png, pdf, svg)) More... | |
const | TASK_SELFCHECK = 'selfcheck' |
Perform a quick self-check to detect most common errors. More... | |
Helper methods | |
| |
static | loadConfig ($base_dir) |
Load configuration from three files (defaults, app, local) and merge it. More... | |
static | createSmalldb ($config) |
Create and initialize Smalldb, including Flupdo and Auth objects. More... | |
static | createRouter ($config, $handler) |
Create API handler. More... | |
static | createHandler ($config, $smalldb) |
Create handler, which processes all API requests from router. More... | |
|
static |
Initialize environment.
Usage:
require __DIR__."/vendor/autoload.php"; list($config, $smalldb) = Smalldb::Rest::Application::initialize(__DIR__);
|
static |
The main()
|
static |
Load configuration from three files (defaults, app, local) and merge it.
|
static |
Create and initialize Smalldb, including Flupdo and Auth objects.
|
static |
Create API handler.
|
static |
Create handler, which processes all API requests from router.
|
static |
Render state diagram.
|
static |
Perform self-check.
const TASK_INIT = 'init' |
Initialization only (for custom scripts)
const TASK_API = 'api' |
Implement Smalldb JSON REST API.
const TASK_DIAGRAM = 'diagram' |
State diagram renderer ($_GET params: machine, format (dot, png, pdf, svg))
const TASK_SELFCHECK = 'selfcheck' |
Perform a quick self-check to detect most common errors.