PHPackages                             processmaker/docker-executor-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. processmaker/docker-executor-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

processmaker/docker-executor-php
================================

PHP script executor for processmaker 4

1.4.5(1w ago)383.2k↓22.9%7[2 issues](https://github.com/ProcessMaker/docker-executor-php/issues)[5 PRs](https://github.com/ProcessMaker/docker-executor-php/pulls)GAGPL-3.0-or-laterPHPCI failing

Since Feb 26Pushed 1w ago22 watchersCompare

[ Source](https://github.com/ProcessMaker/docker-executor-php)[ Packagist](https://packagist.org/packages/processmaker/docker-executor-php)[ RSS](/packages/processmaker-docker-executor-php/feed)WikiDiscussions develop Synced 3d ago

READMEChangelog (7)DependenciesVersions (39)Used By (0)

Build
=====

[](#build)

```
docker build -t processmaker4/executor-php:latest .

```

executor-php
============

[](#executor-php)

Script Task Executor Engine with PHP Runtime

This docker image provides a sandboxed protected environment to run custom PHP scripts that are written in ProcessMaker 4. User created script tasks should be isolated however have utilities available to them in order to get most common tasks done. This PHP environment has PHP packages available and autoloaded so Script Tasks can take advantage of the following libraries:

- guzzlehttp/guzzle: ~6.0
- TODO : Identify most common libraries used for existing script tasks

How to use
----------

[](#how-to-use)

The execution requires a data.json, config.json and an output.json file be present on the host system. The data.json represents the Request instance data. The config.json represents configuration specific for this Script Task. And the output.json should be a blank file that will be populated by the successful output of the script task. The script task is represented by a script.php file. It is the responsibility of the caller to have these files prepared before executing the engine via command line (or docker API).

Script Task design
------------------

[](#script-task-design)

When writing a Script Task, three variables are available. They are:

- $data - A PHP associative array that represents the data loaded from data.json
- $config - A PHP associative array that represents the config loaded from config.json
- $client - The ProcessMaker 4 PHP SDK Client preconfigured to access the API via OAuth authentication

Your script should execute quickly. Once the script is complete, your return statement will be used and converted to JSON which will be stored in the output.json file. Once the docker execution is complete, you should the return code of the docker execution. If the code is 0, then the script task executed successfully and you can read output.json for the valid output. If it is non-zero, then you should review STDERR to see the error that was displayed during execution.

### Example data.json

[](#example-datajson)

```
{
  "firstname": "Taylor"
}
```

### Example Script Task

[](#example-script-task)

```
