No description, website, or topics provided.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/Keboola/Syrup
tests/Keboola/Syrup
.gitignore
.travis.yml
LICENSE
README.md
bootstrap.php
composer.json
phpunit.xml.dist

README.md

Syrup PHP Client Build Status Code Climate Test Coverage

Simple PHP wrapper library for Syrup async calls.

Installation

Library is available as composer package. To start using composer in your project follow these steps:

Install composer

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

Create composer.json file in your project root folder:

{
    "require": {
        "php" : ">=5.4.0",
        "keboola/syrup-php-client": "2.0.*"
    }
}

Install package:

composer install

Add autoloader in your bootstrap script:

require 'vendor/autoload.php';

Read more in Composer documentation

Usage examples

Create and run a job

require 'vendor/autoload.php';

use Keboola\Syrup\Client,

$client = new Client([
  'token' => 'YOUR_TOKEN',
  'runId' => 'CURRENT_RUNID'
]);

$response = $client->runJob("test-component", array("config" => 1));

Encrypt component and project specific string for a Docker component (calls docker/test-component/configs/encrypt)

require 'vendor/autoload.php';

use Keboola\Syrup\Client,

$client = new Client([
  'token' => 'YOUR_TOKEN',
  'runId' => 'CURRENT_RUNID',
  'super' => 'docker'
]);

$response = $client->encryptString("test-component", "string", ["path" => "configs"]);

Create a custom job on a component (calls POST provisioning/async/docker) with {"type" => "rstudio"} body

require 'vendor/autoload.php';

use Keboola\Syrup\Client,

$client = new Client([
  'token' => 'YOUR_TOKEN',
  'runId' => 'CURRENT_RUNID',
  'super' => 'provisioning'
]);

$response = $client->runAsyncAction("async/docker", "POST", ["body" => ["type" => "rstudio"]]);

Create a custom DELETE job on a component (calls DELETE provisioning/async/docker/1)

require 'vendor/autoload.php';

use Keboola\Syrup\Client,

$client = new Client([
  'token' => 'YOUR_TOKEN',
  'runId' => 'CURRENT_RUNID',
  'super' => 'provisioning'
]);

$response = $client->runAsyncAction("async/docker/1", "DELETE");