Skip to content
← Back to projects

Laravel Lemlist

PHP/Laravel client for the Lemlist REST API: campaigns, leads, unsubscribes, activities and webhooks.

Laravel Lemlist

#Laravel Lemlist

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads License

A Laravel client for the Lemlist REST API. A fluent Lemlist facade covers cold-email campaigns, leads, unsubscribes, activities and webhooks, authenticates every request with HTTP Basic auth, and throws a LemlistException on a non-2xx response instead of returning a silent error array.

#Features

  • Teaminfo()
  • Campaignslist(), get(), stats(), export()
  • Leadslist(), get(), add(), delete()
  • Unsubscribeslist(), add(), delete()
  • Activitieslist()
  • Webhookslist(), create(), delete()
  • Thin by design — every method returns the raw decoded JSON response as an array, no DTOs
  • Fails loud — a non-2xx API response throws a LemlistException carrying the API's error message and HTTP status code

#Installation

You can install the package via composer:

composer require jeffersongoncalves/laravel-lemlist

Optionally publish the config file:

php artisan vendor:publish --tag="lemlist-config"

#Configuration

Add to your .env:

LEMLIST_API_KEY=your-api-key

Find your API key in Lemlist under Settings → Integrations → API Key.

#Config Options

// config/lemlist.php
return [
    'api_key' => env('LEMLIST_API_KEY'),
    'base_url' => env('LEMLIST_BASE_URL', 'https://api.lemlist.com/api'),
];

#Usage

use JeffersonGoncalves\Lemlist\Facades\Lemlist;
use JeffersonGoncalves\Lemlist\Exceptions\LemlistException;

#Team

Lemlist::team()->info();

#Campaigns

Lemlist::campaigns()->list(['limit' => 10, 'offset' => 0]);
Lemlist::campaigns()->get('campaign-id');
Lemlist::campaigns()->stats('campaign-id');
Lemlist::campaigns()->export('campaign-id');

#Leads

Lemlist::leads()->list('campaign-id', ['limit' => 10]);
Lemlist::leads()->get('campaign-id', 'lead@acme.com');
Lemlist::leads()->add('campaign-id', 'lead@acme.com', [
    'first-name' => 'Jane',
    'last-name' => 'Doe',
    'company' => 'Acme',
]);
Lemlist::leads()->delete('campaign-id', 'lead@acme.com');

#Unsubscribes

Lemlist::unsubscribes()->list(['limit' => 10]);
Lemlist::unsubscribes()->add('lead@acme.com');
Lemlist::unsubscribes()->delete('lead@acme.com');

#Activities

Lemlist::activities()->list([
    'campaignId' => 'campaign-id',
    'type' => 'emailsOpened',
]);

#Webhooks

Lemlist::webhooks()->list();
Lemlist::webhooks()->create('https://example.com/hook', 'emailsOpened');
Lemlist::webhooks()->delete('hook-id');

#Handling errors

try {
    $result = Lemlist::campaigns()->get('campaign-id');
} catch (LemlistException $e) {
    // $e->getMessage() — the API's error message, or the raw response body
    // $e->errorBody()   — the full decoded JSON error response
}

#Testing

composer test

#Static Analysis

composer analyse

#Code Formatting

composer format

#Changelog

Please see CHANGELOG for more information on what has changed recently.

#Contributing

Please see CONTRIBUTING for details.

#Security

Please review our security policy on how to report security vulnerabilities.

#Credits

#License

The MIT License (MIT). Please see License File for more information.

New version available.