Skip to main content


Fusio contains a generator system which helps to generate operations, schemas and actions from different sources i.e. it can help to create an API from a database or import an OpenAPI specification. The following screenshot shows the generator form:


Every generator has the following fields:


An API Base-Path under which all resources are created i.e. /v1/my_db


Optional a comma separated list of scopes which are assigned to the routes.


Whether all routes are public or private. By default all routes are private so they can only be invoked by an authorized user.


Through this dropdown field you select the actual generator implementation. Depending on the generator you will get additional configuration fields which are required for the specific generator.


You can also easily develop a custom generator i.e. if you want to import resources from a different system or specification. To build a Generator you need to create a class which implements the Fusio\Engine\Generator\ProviderInterface interface. The following Generator creates a route which simply outputs a static message.


namespace App;

use Fusio\Adapter\Util\Action\UtilStaticResponse;
use Fusio\Engine\Form\BuilderInterface;
use Fusio\Engine\Form\ElementFactoryInterface;
use Fusio\Engine\Generator\ProviderInterface;
use Fusio\Engine\Generator\SetupInterface;
use Fusio\Engine\ParametersInterface;
use Fusio\Model\Backend\ActionConfig;
use Fusio\Model\Backend\ActionCreate;
use Fusio\Model\Backend\OperationCreate;
use Fusio\Model\Backend\SchemaCreate;
use Fusio\Model\Backend\SchemaSource;

class MyGenerator implements ProviderInterface
public function getName(): string
return 'My-Generator';

public function setup(SetupInterface $setup, ParametersInterface $configuration): void
$operationId = 'My_Message';
$responseSchema = 'My_Schema';

$schema = new SchemaCreate();

$action = new ActionCreate();
'response' => json_encode(['hello' => $configuration->get('message')]),

$operation = new OperationCreate();
$operation->setDescription('Returns a hello message');

public function configure(BuilderInterface $builder, ElementFactoryInterface $elementFactory): void
$builder->add($elementFactory->newInput('message', 'Message', 'The message'));

private function getMySchema(): array
return [
'definitions' => [
'Message' => [
'type' => 'object',
'properties' => [
'hello' => [
'type' => 'string'
'$ref' => 'Message',

To use this generator place this class at the file src/MyGenerator.php and register the class at the resources/container.php DI container s.


After this you can select the provider at the backend s.


If you execute this provider you will get a simple operation which outputs the following JSON payload.

"hello": "World"