2017 © Pedro Peláez
 

library activecollab-feather-sdk

This is a simple PHP library that makes communication with Active Collab API easy

image

activecollab/activecollab-feather-sdk

This is a simple PHP library that makes communication with Active Collab API easy

  • Saturday, February 10, 2018
  • by ilijastuden
  • Repository
  • 6 Watchers
  • 29 Stars
  • 4,269 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 12 Forks
  • 2 Open issues
  • 16 Versions
  • 14 % Grown

The README.md

PHP SDK for ActiveCollab 5 and 6 API

This is a simple PHP library that makes communication with Active Collab API easy., (*1)

Installation

If you choose to install this application with Composer instead of pulling down the git repository you will need to add a composer.json file to the location you would like to pull the repository down to featuring:, (*2)

{
    "require": {
        "activecollab/activecollab-feather-sdk": "^3.0"
    }
}

Run a composer update to install the package., (*3)

Note: If you used an older version of Active Collab API wrapper and loaded it using dev-master, lock it to version 2.0 by setting require statement to ^2.0 and calling composer update., (*4)

Connecting to Active Collab Cloud Accounts

<?php

require_once '/path/to/vendor/autoload.php';

// Provide name of your company, name of the app that you are developing, your email address and password.
$authenticator = new \ActiveCollab\SDK\Authenticator\Cloud('ACME Inc', 'My Awesome Application', 'you@acmeinc.com', 'hard to guess, easy to remember');

// Show all Active Collab 5 and up account that this user has access to.
print_r($authenticator->getAccounts());

// Show user details (first name, last name and avatar URL).
print_r($authenticator->getUser());

// Issue a token for account #123456789.
$token = $authenticator->issueToken(123456789);

// Did we get it?
if ($token instanceof \ActiveCollab\SDK\TokenInterface) {
    print $token->getUrl() . "\n";
    print $token->getToken() . "\n";
} else {
    print "Invalid response\n";
    die();
}

Connecting to Self-Hosted Active Collab Accounts

require_once '/path/to/vendor/autoload.php';

// Provide name of your company, name of the app that you are developing, your email address and password. Last parameter is URL where your Active Collab is installed.
$authenticator = new \ActiveCollab\SDK\Authenticator\SelfHosted('ACME Inc', 'My Awesome Application', 'you@acmeinc.com', 'hard to guess, easy to remember', 'https://my.company.com/projects');

// Issue a token.
$token = $authenticator->issueToken();

// Did we get what we asked for?
if ($token instanceof \ActiveCollab\SDK\TokenInterface) {
    print $token->getUrl() . "\n";
    print $token->getToken() . "\n";
} else {
    print "Invalid response\n";
    die();
}

SSL problems?

If curl complains that SSL peer verification has failed, you can turn it off like this:, (*5)

// Cloud
$authenticator = new \ActiveCollab\SDK\Authenticator\Cloud('ACME Inc', 'My Awesome Application', 'you@acmeinc.com', 'hard to guess, easy to remember', false);
$authenticator->setSslVerifyPeer(false);

// Self-hosted
$authenticator = new \ActiveCollab\SDK\Authenticator\SelfHosted('ACME Inc', 'My Awesome Application', 'you@acmeinc.com', 'hard to guess, easy to remember', 'https://my.company.com/projects', false);
$authenticator->setSslVerifyPeer(false);

// Client
$client = new \ActiveCollab\SDK\Client($token);
$client->setSslVerifyPeer(false);

Note: Option to turn off SSL peer verification has been added in Active Collab SDK 3.1., (*6)

Constructing a client instance

Once we have our token, we can construct a client and make API calls:, (*7)

$client = new \ActiveCollab\SDK\Client($token);

Listing all tasks in project #65 is easy. Just call:, (*8)

$client->get('projects/65/tasks');

To create a task, simply send a POST request:, (*9)

try {
    $client->post('projects/65/tasks', [
      'name' => 'This is a task name',
      'assignee_id' => 48
    ]);
} catch(AppException $e) {
    print $e->getMessage() . '<br><br>';
    // var_dump($e->getServerResponse()); (need more info?)
}

To update a task, PUT request will be needed:, (*10)

try {
    $client->put('projects/65/tasks/123', [
        'name' => 'Updated named'
    ]);
} catch(AppException $e) {
    print $e->getMessage() . '<br><br>';
    // var_dump($e->getServerResponse()); (need more info?)
}

post() and put() methods can take two arguments:, (*11)

  1. command (required) - API command,
  2. variables - array of request variables (payload)

To remove a task, call:, (*12)

try {
    $client->delete('projects/65/tasks/123');
} catch(AppException $e) {
    print $e->getMessage() . '<br><br>';
    // var_dump($e->getServerResponse()); (need more info?)
}

delete() method only requires command argument to be provided., (*13)

For full list of available API command, please check Active Collab API documentation., (*14)

The Versions

10/02 2018

dev-master

9999999-dev https://github.com/activecollab/activecollab-feather-sdk

This is a simple PHP library that makes communication with Active Collab API easy

  Sources   Download

MIT

The Requires

  • ext-curl *
  • php >=5.6.0

 

The Development Requires

by Ilija Studen

api sdk activecollab

10/05 2017

3.1.2

3.1.2.0 https://github.com/activecollab/activecollab-feather-sdk

This is a simple PHP library that makes communication with Active Collab API easy

  Sources   Download

MIT

The Requires

  • php >=5.6.0
  • ext-curl *

 

The Development Requires

by Ilija Studen

api sdk activecollab

09/02 2017

3.1.1

3.1.1.0 https://github.com/activecollab/activecollab-feather-sdk

This is a simple PHP library that makes communication with Active Collab API easy

  Sources   Download

MIT

The Requires

  • php >=5.6.0
  • ext-curl *

 

The Development Requires

by Ilija Studen

api sdk activecollab

17/06 2016

3.1.0

3.1.0.0 https://github.com/activecollab/activecollab-feather-sdk

This is a simple PHP library that makes communication with Active Collab API easy

  Sources   Download

MIT

The Requires

  • php >=5.6.0
  • ext-curl *

 

The Development Requires

by Ilija Studen

api sdk activecollab

16/01 2016

3.0.0

3.0.0.0 https://github.com/activecollab/activecollab-feather-sdk

This is a simple PHP library that makes communication with Active Collab API easy

  Sources   Download

MIT

The Requires

  • php >=5.6.0
  • ext-curl *

 

The Development Requires

by Ilija Studen

api sdk activecollab

15/01 2016

2.0.4

2.0.4.0 https://github.com/activecollab/activecollab-feather-sdk

This is a simple PHP library that makes communication with Active Collab API easy

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *

 

by Ilija Studen

api sdk activecollab

17/11 2015

2.0.3

2.0.3.0 https://github.com/activecollab/activecollab-feather-sdk

This is a simple PHP library that makes communication with Active Collab API easy

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *

 

by Ilija Studen

api sdk activecollab

25/09 2015

2.0.2

2.0.2.0 https://github.com/activecollab/activecollab-feather-sdk

This is a simple PHP library that makes communication with Active Collab API easy

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *

 

by Ilija Studen

api sdk activecollab

05/03 2015

2.0.1

2.0.1.0 https://github.com/activecollab/activecollab-feather-sdk

This is a simple PHP library that makes communication with ActiveCollab Feather API easy

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *

 

by Ilija Studen

activecollab

05/03 2015

2.0.0

2.0.0.0 https://github.com/activecollab/activecollab-sdk

This is a simple PHP library that makes communication with activeCollab API easy

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *

 

by Ilija Studen

activecollab

27/06 2014

1.0.5

1.0.5.0 https://www.activecollab.com/add-ons.html

This is a simple PHP library that makes communication with activeCollab API easy

  Sources   Download

MIT

by Ilija Studen

activecollab

27/06 2014

1.0.4

1.0.4.0 https://www.activecollab.com/add-ons.html

This is a simple PHP library that makes communication with activeCollab API easy

  Sources   Download

MIT

by Ilija Studen

activecollab

12/06 2014

1.0.3

1.0.3.0 https://www.activecollab.com/add-ons.html

This is a simple PHP library that makes communication with activeCollab API easy

  Sources   Download

MIT

by Ilija Studen

activecollab

11/06 2014

1.0.2

1.0.2.0 https://www.activecollab.com/add-ons.html

This is a simple PHP library that makes communication with activeCollab API easy

  Sources   Download

MIT

by Ilija Studen

activecollab

11/05 2014

1.0.1

1.0.1.0 https://www.activecollab.com/add-ons.html

This is a simple PHP library that makes communication with activeCollab API easy

  Sources   Download

MIT

by Ilija Studen

activecollab

11/05 2014

1.0.0

1.0.0.0 https://github.com/activecollab/activecollab-sdk

This is a simple PHP library that makes communication with activeCollab API easy

  Sources   Download

MIT

by Ilija Studen

activecollab