PHP code example of torchlighttechnology / ttg-sdk

1. Go to this page and download the library: Download torchlighttechnology/ttg-sdk 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/ */

    

torchlighttechnology / ttg-sdk example snippets


use torchlighttechnology\TtgSDK;

$api = new TtgSDK(
  'URL', // 
  'foo' => 'bar'
];

// your API method must be a dashed route
// calling it here needs to be camelcased
$response = $api->yourExposedApiMethod( // translates to your-exposed-api-method
  json_encode($args), // JSON encoded array
  'POST' // request type of GET, POST, PUT, DELETE
);

use torchlighttechnology\TtgSDK;

$api = new TtgSDK(
  'http://delayedevents/delayed-events/'
);

// Add custom headers
$api->setHeaders( ['x-api-key: abc1234'] );

$args = [
  $callback_uri,
  $parameters,
  $fire_date
];
$response = $api->create(
  json_encode($args),
  'POST'
);