Coder Social home page Coder Social logo

syrup-php-client's Introduction

Syrup PHP Client

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.

syrup-php-client's People

Contributors

ondrejhlavacek avatar odinuv avatar mirocillik avatar kachnitel avatar halama avatar pivnicek avatar romanbracinik avatar ujovlado avatar

Watchers

Štěpán Vraný avatar Martin Zajíc avatar Roman Pištěk avatar  avatar  avatar Vojtěch Biberle avatar James Cloos avatar  avatar  avatar Erik Zigo avatar Pavel Šuraba avatar David Střítežský avatar  avatar  avatar Jakub Kotek avatar Jiří Semmler avatar Martin Vaško avatar Martin Jandl avatar  avatar

syrup-php-client's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.