### Install mailXpert PHP SDK with Composer Source: https://github.com/mailxpert/mailxpert-php-sdk/blob/master/README.md Install the mailXpert PHP SDK using Composer. This is the recommended method for managing dependencies. ```bash composer require mailxpert/php-sdk ``` -------------------------------- ### Perform API Request with Access Token Source: https://github.com/mailxpert/mailxpert-php-sdk/blob/master/README.md Make a GET request to the '/contact_lists' endpoint using a provided access token. The response is JSON decoded. ```php $data = json_decode($mailxpert->sendRequest('GET','/contact_lists',[], $accessToken), true); $contactLists = $data['data']; ``` -------------------------------- ### Perform API Request after Setting Access Token Source: https://github.com/mailxpert/mailxpert-php-sdk/blob/master/README.md Make a GET request to the '/contact_lists' endpoint after setting the access token globally. No token parameter is needed. ```php $mailxpert->sendRequest('GET','/contact_lists'); ``` -------------------------------- ### Initialize Mailxpert SDK Source: https://github.com/mailxpert/mailxpert-php-sdk/blob/master/README.md Initialize the Mailxpert SDK with your application's credentials. Ensure you have your appId and appSecret. ```php $mailxpert = new Mailxpert([ 'app_id' => $appId, 'app_secret' => $appSecret ]); ``` -------------------------------- ### Display 'Login with mailXpert' Button Source: https://github.com/mailxpert/mailxpert-php-sdk/blob/master/README.md Generate a link to initiate the OAuth login flow with mailXpert. The redirectUrl parameter is required. ```php Login with mailXpert ``` -------------------------------- ### Set Access Token for Subsequent Requests Source: https://github.com/mailxpert/mailxpert-php-sdk/blob/master/README.md Set a persistent access token for the Mailxpert instance. This avoids passing the token with every request. ```php $mailxpert->setAccessToken($access_token); ``` -------------------------------- ### Retrieve Access Token after Login Source: https://github.com/mailxpert/mailxpert-php-sdk/blob/master/README.md Obtain the access token after a successful user login. This code should be placed on the redirect URL page. ```php if (isset($_REQUEST['code'])) { $accessToken = $mailxpert->getLoginHelper()->getAccessToken($redirectUrl); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.