ActiveCollab Api Wrapper 3.0

ActiveCollab Api Wrapper 3.0

Easier token issuing and authentication

We're happy to announce that ActiveCollab API wrapper for PHP is hitting version 3.0, bringing easier token issuing and authentication.

Token issuing

There are now two authenticators that make the authentication a lot easier. To grab a token for one of your ActiveCollab Cloud accounts, you should use Cloud authenticator:

require_once '/path/to/vendor/autoload.php';
$authenticator = new \ActiveCollab\SDK\Authenticator\Cloud('ACME Inc', 'My Awesome Application', 'you@acmeinc.com', 'hard to guess, easy to remember');
// Show all ActiveCollab 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);

There’s also an authenticator for self-hosted ActiveCollab setups:

require_once '/path/to/vendor/autoload.php';
// Construct a self-hosted authenticator. Last parameter is URL where your ActiveCollab 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();

Making API requests

Once you get the token, you can create a client and make API requests:

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

Note that `$token` here is not a string, but an object that has both API URL and the token in it, so you should store both values if you want to reuse it later on:

// Create token using saved token and URL
$token_from_settings = new \ActiveCollab\SDK\Token('...', '...');
$client = new \ActiveCollab\SDK\Client($token_from_settings);

Our development team hopes you'll find these changes helpful and so you can create some interesting integrations and add-ons.
If you have any questions about API SDK or how to use it, raise a GitHub issue or create a Stack Overflow question and tag it with activecollab tag, and we'll do our best to help you.

Close