Introduction
The main information explaining how to install and use Mailerlite PHP SDK is on its GitHub page here.
Here is an example showing how to start using any available API endpoint right away:
<?php
require 'vendor/autoload.php';
$mailerliteClient = new \MailerLiteApi\MailerLite('your-api-key');
$groupsApi = $mailerliteClient->groups();
$groups = $groupsApi->get(); // returns array of groups
$fieldsApi = $mailerliteClient->fields();
$fields = $fieldsApi->get(); // returns array of fields
Or access any single available API separately:
<?php
require 'vendor/autoload.php';
$groupsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->groups();
$allGroups = $groupsApi->get(); // returns array of groups
$groupId = 123;
$singleGroup = $groupsApi->find($groupId); // returns single item object
You will find more examples using PHP SDK in the endpoint reference pages.
Updated over 4 years ago