PHP code example of activecollab / activecollab-sdk

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

    

activecollab / activecollab-sdk example snippets




  ActiveCollab\Client as API;
  use \ActiveCollab\Connectors\Curl as CurlConnector;
  use \ActiveCollab\Exceptions\AppException;

  API::setUrl('MY-API-URL');
  API::setKey('MY-API-TOKEN');
  API::setConnector(new CurlConnector);

  print '<pre>';
  print_r(API::info());
  print '</pre>';



  ActiveCollab\Client as API;
  use \ActiveCollab\Connectors\Curl as CurlConnector;
  use \ActiveCollab\Exceptions\AppException;

  API::setUrl('MY-API-URL');
  API::setKey('MY-API-TOKEN');
  API::setConnector(new CurlConnector);

  print '<pre>';
  print_r(API::info());
  print '</pre>';

API::call('projects/65/tasks');

try {
  API::call('projects/65/tasks/add', null, array(
    'task[name]' => 'This is a task name',
    'task[assignee_id]' => 48,
    'task[other_assignees]' => array(3, 1),
  ), array(
    '/attach.jpeg'
  ));
} catch(AppException $e) {
  print $e->getMessage() . '<br><br>';
  // var_dump($e->getServerResponse()); (need more info?)
} // try