1. Go to this page and download the library: Download gostellarco/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/ */
gostellarco / nylas-php example snippets
use Nylas\Client;
$options =
[
'debug' => true,
'region' => 'oregon', // server region, can be oregon, ireland or canada, default is oregon
'log_file' => dirname(__FILE__) . '/test.log', // a file path or a resource handler
'account_id' => 'your account id',
'access_token' => 'your access token',
'client_id' => 'your client id', //
$nylas->Options()->
$id = 'id_xxx';
$ids = ['id_xxx', 'id_yyy', ...];
// one per time
$dataA = $nylas->Contacts()->Contact()->getContact($id);
$dataB = $nylas->Contacts()->Contact()->deleteContact($id);
// batch request
$dataC = $nylas->Contacts()->Contact()->getContact($ids);
$dataD = $nylas->Contacts()->Contact()->deleteContact($ids);
$params =
[
'state' => 'testing',
'login_hint' => '[email protected]',
'redirect_uri' => 'https://www.test.com/redirect_callback',
];
// generate the url that your user need be redirect to.
$url = $nylas->Authentication()->Hosted()->getOAuthAuthorizeUrl($params);
$data = $nylas->Authentication()->Hosted()->postOAuthToken($params);
// save your token some where
// or update the client option
$nylas->Options()->setAccessToken("pass the token you got");