Using parameters

Limit & Offset

You can provide limit and offset parameters chaining corresponding methods to your API query. These methods are useful if you want to use pagination.

limit(int $limit)
offset(int $offset)


$groupsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->groups();

$items = $groupsApi->limit(10)->get(); // the first ten items (page one)
$items = $groupsApi->limit(10)->offset(10)->get(); // page two
$items = $groupsApi->limit(10)->offset(20)->get(); // page three

Order by

You can order data by selected column using this method:

orderBy(string $column, string $order)


$groupsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->groups();

$items = $groupsApi->orderBy('name', 'DESC')->get(); // order by name descending
$items = $groupsApi->orderBy('name', 'ASC')->get(); // order by name ascending


Also, you can find items using criteria by any other field value using where method.

where(array $filters)

When you want to get items by exact value of field, $filters are should look like this:

$filters = ['column_title' => $value];

$groupsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->groups();

$items = $groupsApi->where(['date_created' => '2016-01-01'])->get(); // get groups which have 4 active subscribers


There is an ability to use operators when you want to get items:

  • $gt (greater than)
  • $gte (greater than or equal)
  • $lt (less than)
  • $lte (less than or equal)
  • $ne (not equal)
  • $like (like)

In that case, $filters array should look like this:

$filters = [
  'column_title' => [
    'operator' => $value

$groupsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->groups();

$items = $groupsApi->where([
    'active' => [
        '$gte' => 4
  ])->get(); // get groups which have 4 or more active subscribers