PHP code example of sumocoders / teamleader-oauth2

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

    

sumocoders / teamleader-oauth2 example snippets


interface TokenStorageInterface
{
    public function getTokenType(): string;
    public function getAccessToken(): ?string;
    public function getRefreshToken(): ?string;
    public function isExpired(): bool;
    public function storeTokens(array $tokens): void;
}

$teamleader->acquireAccessToken($redirectUrl, $code);

$teamleader->get('users.me');
$teamleader->get('departments.list');
$teamleader->get('companies.list');

$teamleader->post(
    'contacts.add',
    [
        'first_name' => 'John',
        'last_name' => 'Doe',
    ]
);
$teamleader->post(
    'contacts.update',
    [
        'id' => 'xxx',
        'first_name' => 'John',
        'last_name' => 'Doe',
        'emails' => [
            ['type' => 'primary', 'email' => '[email protected]'],
        ],
    ]
)