1. Go to this page and download the library: Download setka/workflow-php-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/ */
setka / workflow-php-sdk example snippets
use Setka\WorkflowSDK\APIFactory;
use Setka\WorkflowSDK\Actions\Spaces\GetSpaceAction;
try {
// Use APIFactory for quick usage or to create manually.
$api = APIFactory::create('YOUR_TOKEN');
// Create an Action to obtain data.
$action = new GetSpaceAction($api);
// Prevent generating Guzzle exceptions.
$details = $action->configureDetails(array(
'options' => array(
'http_errors' => false,
),
));
$entity = $action
// Save settings and parameters
->setDetails($details)
// Perform a request
->request()
// Handling response to requests (each Action has its own handleResponse method)
->handleResponse();
// If no exception is thrown, your request was successful.
// You can then move on to use $entity object (Setka\WorkflowSDK\Entities\SpaceEntity).
$shortName = $entity->getShortName();
$name = $entity->getName();
} catch (\Exception $exception) {
// Error
}
try {
$api = APIFactory::create('YOUR_TOKEN');
// Creating an action to set up a category
$action = new CreateCategoryAction($api);
// Configuring an action
$details = $action->configureDetails(array(
// Use a value from a previous request
'space' => 'your-space-short-name',
'options' => array(
// Disable exceptions in Guzzle
'http_errors' => false,
'json' => array(
'name' => 'Your name for category',
),
),
));
$entity = $action
->setDetails($details)
->request()
->handleResponse();
// Category sucessfylly created!
// Using $entity instance in your code
} catch (\Exception $exception) {
// Error
}
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.