keboola / syrup-php-client
Keboola Syrup PHP Client
Installs: 25 029
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 18
Forks: 0
Open Issues: 0
Requires
- php: >=7.4
- guzzlehttp/guzzle: ^7.4
Requires (Dev)
- monolog/monolog: ^1.24
- phpunit/phpunit: ^5.7
- squizlabs/php_codesniffer: ^3.3
This package is auto-updated.
Last update: 2024-11-03 15:17:20 UTC
README
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");
License
MIT licensed, see LICENSE file.