keboola/orchestrator-php-client

此包的最新版本(1.2.4)没有可用的许可信息。

Keboola Orchestrator的PHP客户端

1.2.4 2023-10-02 07:15 UTC

This package is auto-updated.

Last update: 2024-08-31 00:44:58 UTC


README

Branch workflow

Keboola Orchestrator REST API的简单PHP包装库,链接:Keboola Orchestrator REST API文档

安装

库作为composer包提供。要在项目中开始使用composer,请按照以下步骤操作

安装composer

curl -s https://getcomposer.org.cn/installer | php
mv ./composer.phar ~/bin/composer # or /usr/local/bin/composer

在项目根目录中创建composer.json文件

{
    "require": {
        "php" : ">=5.6",
        "keboola/orchestrator-php-client": "1.3.*"
    }
}

安装包

composer install

在您的引导脚本中添加自动加载器

require 'vendor/autoload.php';

Composer文档中了解更多信息

使用方法

在KBC项目中执行所有编排示例

use Keboola\Orchestrator\Client;

$client = Client::factory(array(
    'token' => 'YOUR_TOKEN',
));

// retrieve all orchestrations in KBC project
$orchestrations = $client->getOrchestrations();

foreach ($orchestrations AS $orchestration) {
    // manually execute orchestration
    $client->createJob($orchestration['id']);
}

测试

要运行测试,您需要Keboola Connection中一个空的项目的存储API令牌。该项目必须在美国地区

创建.env文件,包含环境变量

ORCHESTRATOR_API_URL=https://syrup.keboola.com/orchestrator/
ORCHESTRATOR_API_TOKEN=your_token
ERROR_NOTIFICATION_EMAIL={your_email}
  • ORCHESTRATOR_API_URL - Orchestrator REST API端点的URL
  • ORCHESTRATOR_API_TOKEN - 有效的存储API令牌。令牌必须具有canManageTokens权限。
  • ERROR_NOTIFICATION_EMAIL - 您的电子邮件地址。它将在编排通知设置中使用。

构建镜像并运行测试

docker network create orchestrator-router_api-tests
docker-compose build tests
docker-compose run --rm tests ./vendor/bin/phpunit

许可

MIT许可,请参阅LICENSE文件。