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\Connector;
use Fusio\Worker\Dispatcher;
use Fusio\Worker\ExecuteContext;
use Fusio\Worker\ExecuteRequest;
use Fusio\Worker\Logger;
use Fusio\Worker\ResponseBuilder;

return function(ExecuteRequest $request, ExecuteContext $context, Connector $connector, ResponseBuilder $response, Dispatcher $dispatcher, Logger $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