Skip to main content

Worker PHP

The Worker-PHP executes the provided PHP code at the remote worker. More information about the worker at: https://github.com/apioo/fusio-worker-php

Example

<?php

use Fusio\Worker\ExecuteContext;
use Fusio\Worker\ExecuteRequest;
use Fusio\Engine\ConnectorInterface;
use Fusio\Engine\Response\FactoryInterface;
use Fusio\Engine\DispatcherInterface;
use Psr\Log\LoggerInterface;

return function(ExecuteRequest $request, ExecuteContext $context, ConnectorInterface $connector, FactoryInterface $response, DispatcherInterface $dispatcher, LoggerInterface $logger) {
$connection = $connector->getConnection('app');

$query = 'SELECT name, description FROM app_product_0';
$entries = $connection->fetchAllAssociative($query);

return $response->build(200, [], [
'foo' => 'bar',
'entries' => $entries,
]);
};

Types

This table contains an overview which connection types are implemented and which implementation is used:

TypeImplementation
Fusio.Adapter.Sql.Connection.Sqldoctrine/dbal
Fusio.Adapter.Sql.Connection.SqlAdvanceddoctrine/dbal
Fusio.Adapter.Http.Connection.Httpguzzlehttp/guzzle
Fusio.Adapter.Mongodb.Connection.MongoDBmongodb/mongodb
Fusio.Adapter.Elasticsearch.Connection.Elasticsearchelasticsearch/elasticsearch

Video