PHP code example of turanct / engagor-api

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

    

turanct / engagor-api example snippets


$httpRequestFactory = new Nyholm\Psr7\Factory\Psr17Factory();
$httpClient = new Buzz\Client\Curl($httpRequestFactory);

$clientId = '<CLIENT ID HERE>';
$clientSecret = '<CLIENT SECRET HERE>';

$authentication = new Engagor\Authentication(
    $httpClient,
    $httpRequestFactory,
    $clientId,
    $clientSecret
);

$url = $authentication->step1(
    [
        'identify',
        'accounts_read',
        'accounts_write',
        'socialprofiles',
        'email',
    ],
    '<RANDOM STATE HERE>'
);

$tokens = $authentication->step2('<YOUR AUTH CODE>');

$client = new Engagor\Client(
    $httpClient,
    $httpRequestFactory,
    $tokens
);

$me = $client->me();

$request = $httpRequestFactory->createRequest(
    'GET',
    'https://api.engagor.com/me/'
);

$response = $client->execute($request);