PHP code example of jwread / olivetin-bindings-php

1. Go to this page and download the library: Download jwread/olivetin-bindings-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jwread / olivetin-bindings-php example snippets




use OliveTin\Api\OliveTinClient;
use OliveTin\Api\OliveTinApiException;

$client = new OliveTinClient('http://127.0.0.1:1337', getenv('OLIVETIN_TOKEN'));

try {
    $client->init();

    $started = $client->startAction(
        bindingId: 'your-binding-id',
        arguments: ['message' => 'hello'],
    );
    echo $started['executionTrackingId'];

    $log = $client->startActionAndWait(
        actionId: 'your-action-id',
        arguments: [],
    );
    echo $log['output'];
} catch (OliveTinApiException $e) {
    fwrite(STDERR, $e->getMessage() . ' (HTTP ' . $e->httpStatus() . ")\n");
}

new OliveTinClient('https://example.com', $token, apiPrefix: '/olivetin/api');
bash
composer