Fusio

Simply build and
manage REST APIs

Fusio is an open source API management platform which helps to build and manage REST APIs. Fusio provides all tools to quickly build an API from different data sources yet it is possible to create complete customized responses.

Development

With Fusio you only have to describe the capabilities of each API endpoint in a simple yaml file. All other aspects of the API lifecycle are managed by Fusio. So you can concentrate on building the actual business logic of your API.

# Routes
routes:
  "/todo": !include resources/routes/todo/collection.yaml
  "/todo/:todo_id": !include resources/routes/todo/entity.yaml

# Schemas
schema:
  Todo: !include resources/schema/todo/entity.json
  Todo-Collection: !include resources/schema/todo/collection.json
  Message: !include resources/schema/message.json

# Connections
connection: !include resources/connections.yaml

# Migrations
migration: !include resources/migrations.yaml
version: 1
methods:
  GET:
    public: true
    responses: 
      200: Todo-Collection
      500: Message
    action: "${dir.src}/Todo/collection.php"
  POST:
    public: false
    request: Todo
    responses: 
      201: Message
      500: Message
    action: "${dir.src}/Todo/insert.php"
<?php
/**
 * @var \Fusio\Engine\ConnectorInterface $connector
 * @var \Fusio\Engine\RequestInterface $request
 * @var \Fusio\Engine\Response\FactoryInterface $response
 * @var \Fusio\Engine\ProcessorInterface $processor
 * @var \Psr\Log\LoggerInterface $logger
 * @var \Psr\SimpleCache\CacheInterface $cache
 */

/** @var \Doctrine\DBAL\Connection $connection */
$connection = $connector->getConnection('Default-Connection');

$count   = $connection->fetchColumn('SELECT COUNT(*) FROM app_todo');
$entries = $connection->fetchAll('SELECT * FROM app_todo WHERE status = 1 ORDER BY insertDate DESC LIMIT 16');

return $response->build(200, [], [
    'totalResults' => $count,
    'entry' => $entries,
]);
{
  "type": "object",
  "title": "todo",
  "properties": {
    "id": {
      "type": "integer"
    },
    "status": {
      "type": "integer"
    },
    "title": {
      "type": "string",
      "minLength": 3,
      "maxLength": 32
    },
    "insertDate": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": ["title"]
}
<?php
/**
 * @var \Doctrine\DBAL\Schema\Schema $schema
 */

$todoTable = $schema->createTable('app_todo');
$todoTable->addColumn('id', 'integer', ['autoincrement' => true]);
$todoTable->addColumn('status', 'integer', ['default' => 1]);
$todoTable->addColumn('title', 'string', ['length' => 64]);
$todoTable->addColumn('insertDate', 'datetime');
$todoTable->setPrimaryKey(['id']);

Features

Once the API is deployed Fusio provides the following features out of the box:

build

API management

Fusio provides a powerful backend app to control and monitor your API.

assessment

Developer portal

Fusio provides a developer portal app where developer can register to use your API.

book

Documentation

Fusio provides a documentation app which shows all available API endpoints.

layers

JSON Schema

Fusio validates all incoming requests accordingly to the provided JSON schema.

account_box

OAuth2 authorization

App developer can obtain an access token to access non-public API endpoints.

swap_horiz

Rate limiting

Fusio provides a way to rate limit requests based on the user or app.

cloud_queue

Schema generation

Fusio provides an endpoint to automatically generate RAML and OAI specifications.

device_hub

JWT

For SPAs users can request a JWT to access protected parts of the API.

label_outline

Scope handling

Each user and app can be limited to scopes to request only specific parts of the API.