PHP code example of mailmatics / php-sdk

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

    

mailmatics / php-sdk example snippets




use Mailmatics\Client;

$client = new Client(['apiKey' => '...']);

use Mailmatics\Client;

$client = new Client(['username' => 'admin', 'password' => '12345']);

use Mailmatics\Client;
use Mailmatics\HttpClient\CurlClient;

$client = new Client($credentials, $options, new CurlClient());

use Mailmatics\HttpClient\GuzzleHttpClient;

$httpClient = new GuzzleHttpClient();

use GuzzleHttp\Client as GuzzleClient;
use Mailmatics\HttpClient\GuzzleHttpClient;

$guzzleClient = new GuzzleClient();
$httpClient = new GuzzleHttpClient($guzzleClient);

$lists = $client->getLists()->all();

$list = $client->getLists()->get(123);

$list = $client->getLists()->addSubscriber($listId, $email);

$data = [
	'firstname' => 'John',
	'lastname' => 'Smith',
];

$list = $client->getLists()->addSubscriber(123, $email, $data);

$data = [
	'fullname' => 'John Smith',
];

$list = $client->getLists()->addSubscriber(123, $email, $data);

$list = $client->getLists()->unsubscribe($listId, $subscriberId);

$emails = $client->getTransactional()->all();

$email = $client->getTransactional()->get(123);

$data = [
	'firstName' => 'John',
	'lastName' => 'Smith'
];

$email = $client->getTransactional()->send(123, '[email protected]', $data);

$data = [
	'firstName' => 'John',
	'lastName' => 'Smith'
];

$schedule = new DateTime('2018-12-25 12:30:00');

$email = $client->getTransactional()->send(123, '[email protected]', $data, $schedule);