PHP code example of brainstream / nylas-php

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

    

brainstream / nylas-php example snippets


use Nylas\Client;

'api_key'   => 'NYLAS_API_KEY',
    'client_id' => 'NYLAS_CLIENT_ID',
    'region'    => 'NYLAS_REGION', // optional - Default "us"
];

$nylasClient = new Client($options);

try {
    $applications = $nylasClient->Administration->Application->list();
    print_r($applications);
} catch (GuzzleException) {}

try {
    $grants = $nylasClient->Administration->Grants->list();
    print_r($grants);
} catch (GuzzleException) {}

try {
    $connectors = $nylasClient->Administration->Connectors->list();
    print_r($connectors);
} catch (GuzzleException) {}

try {
    $credentials = $nylasClient->Administration->ConnectorsCredentials->list(
        PROVIDER_STRING
    );
    print_r($credentials);
} catch (GuzzleException) {}

//NOTE: Replace "PROVIDER_STRING" with real provider string

try {
    $messages = $nylasClient->Messages->Message->list(
        GRANT_ID_STRING
    );
    print_r($messages);
} catch (GuzzleException) {}

//NOTE: Replace "GRANT_ID_STRING" with real grant id

try {
    $calendars = $nylasClient->Calendars->Calendar->list(
        GRANT_ID_STRING
    );
    print_r($calendars);
} catch (GuzzleException) {}

//NOTE: Replace "GRANT_ID_STRING" with real grant id

try {
    $drafts = $nylasClient->Drafts->Draft->list(
        GRANT_ID_STRING
    );
    print_r($drafts);
} catch (GuzzleException) {}

//NOTE: Replace "GRANT_ID_STRING" with real grant id
shell
composer