processmaker/docker-executor-php
Composer 安装命令:
composer require processmaker/docker-executor-php
包简介
PHP script executor for processmaker 4
README 文档
README
docker build -t processmaker4/executor-php:latest .
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
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
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
{
"firstname": "Taylor"
}
Example Script Task
<?php // Uppercase the entire firstname attribute $data['firstname'] = strtoupper($data['firstname']); // Return it return $data;
Example output.json
{"firstname":"TAYLOR"}
Command Line Usage
$ docker run -v <path to local data.json>:/opt/executor/data.json \ -v <path to local config.json>:/opt/executor/config.json \ -v <path to local script.php>:/opt/executor/script.php \ -v <path to local output.json>:/opt/executor/output.json \ processmaker/executor:php \ php /opt/executor/bootstrap.php
License
Distributed under the AGPL Version 3
ProcessMaker (C) 2002 - 2020 ProcessMaker Inc.
For further information visit: http://www.processmaker.com/
processmaker/docker-executor-php 适用场景与选型建议
processmaker/docker-executor-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 82.4k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2020 年 04 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 processmaker/docker-executor-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 processmaker/docker-executor-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 82.4k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GAGPL-3.0-or-later
- 更新时间: 2020-04-06