New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

rossbearman/laravel-active-campaign

Add Active Campaign to your Laravel application.
38,245 5
Install
composer require rossbearman/laravel-active-campaign
Latest Version:v1.3.4
PHP:^8.1
Laravel:10 – 13
License:MIT
Last Updated:Aug 21, 2026
Links: GitHub  ·  Packagist
Maintainer: rossbearman

Laravel ActiveCampaign

Latest Stable Version MIT Licensed

This package provides a simple interface to the ActiveCampaign API v3. It is a continuation of the original laravel-active-campaign package by Tjardoo/Label84 and can easily be migrated.

The package currently supports Contacts, Custom Fields, Custom Fields Values, Tags, Lists and Messages. Feel free to open a pull request to add support for other endpoints.

Laravel Support

Version Release
10.x 1.3
11.x 1.3.1
12.x 1.3.2
13.x 1.3.3

Installation

1. Install the package via composer

composer require rossbearman/laravel-active-campaign

2. Publish the config file

php artisan vendor:publish --provider="RossBearman\ActiveCampaign\ActiveCampaignServiceProvider" --tag="config"

3. Add the base URL and API key to your .env

ACTIVE_CAMPAIGN_BASE_URL=
ACTIVE_CAMPAIGN_API_KEY=

Migrating from Label84/ActiveCampaign

The only change required to migrate to v1.3 is replacing Label84 with RossBearman in namespaces and requiring rossbearman/laravel-active-campaign instead of label84/laravel-active-campaign in your composer.json file.

Usage

Access via facade:

use RossBearman\ActiveCampaign\Facades\ActiveCampaign;

$contact = ActiveCampaign::contacts()->get(1);

Resolve directly out of the container:

use RossBearman\ActiveCampaign\ActiveCampaign;

$contact = resolve(ActiveCampaign::class)->contacts()->get(1);

Inject into a constructor or method via automatic injection:

use RossBearman\ActiveCampaign\ActiveCampaign;

class ContactController extends Controller
{
    public function __construct(private readonly ActiveCampaign $activeCampaign) { }

    $this->activeCampaign->contacts()->get(1);
}

Examples

The following examples use the facade for simplicity and assume RossBearman\ActiveCampaign\Facades\ActiveCampaign has been imported.

Contacts

Retrieve an existing contact
$contact = ActiveCampaign::contacts()->get(1);
List all contact, search contacts, or filter contacts by query defined criteria

See the API docs for a full list of possible query parameters.

$contacts = ActiveCampaign::contacts()->list();
$contactByEmail = ActiveCampaign::contacts()->list('email=info@example.com');
$singleList = ActiveCampaign::contacts()->list('listid=1');
Create a new contact
$contactId = ActiveCampaign::contacts()->create('info@example.com', [
    'firstName' => 'John',
    'lastName' => 'Doe',
    'phone' => '+3112345678',
]);
Create a contact if they don't exist, or update an existing contact
$contact = ActiveCampaign::contacts()->sync('info@example.com', [
    'firstName' => 'John',
    'lastName' => 'Doe',
    'phone' => '+3112345678',
]);
Update an existing contact
use RossBearman\ActiveCampaign\DataObjects\ActiveCampaignContact;

$contact = new ActiveCampaignContact(
    id: 1,
    email: 'info@example.com',
    phone: '+3112345678',
    firstName: 'John',
    lastName: 'Deer',
);

ActiveCampaign::contacts()->update($contact);
Update the status of a contact on a list

The status should be 1 for subscribed and 2 for unsubscribed

$contact = ActiveCampaign::contacts()->updateListStatus(
    contactId: 1,
    listId: 1,
    status: 1,
);
Delete an existing contact
ActiveCampaign::contacts()->delete(1);
Add a tag to contact
$contactTagId = ActiveCampaign::contacts()->tag(
    id: 1,
    tagId: 20
);
Remove a tag from a contact
ActiveCampaign::contacts()->untag(contactTagId: 2340);

Custom Field Values

Retrieve an existing field value
$fieldValue = ActiveCampaign::fieldValues()->get(50);
Create a field value
$fieldValueId = ActiveCampaign::fieldValues()->create(
    contactId: 1,
    fieldId: 50,
    value: 'active',
);
Update an existing field value
use RossBearman\ActiveCampaign\DataObjects\ActiveCampaignFieldValue;

$fieldValue = new ActiveCampaignFieldValue(
    contactId: 1,
    field: 50,
    value: 'inactive',
);

ActiveCampaign::fieldValues()->update($fieldValue);
Delete an existing field value
ActiveCampaign::fieldValues()->delete(50);

Custom Fields

Retrieve an existing field
$field = ActiveCampaign::fields()->get(1);
Create a field
$fieldId = ActiveCampaign::fields()->create(
    type: 'textarea',
    title: 'about',
    description: 'Short introduction',
);
Update an existing field
use RossBearman\ActiveCampaign\DataObjects\ActiveCampaignField;

$fieldValue = new ActiveCampaignField(
    id: 1,
    type: 'textarea',
    title: 'about',
    description: 'Relevant skills',
);

ActiveCampaign::fields()->update($fieldValue);
Delete an existing field
ActiveCampaign::fields()->delete(1);

Tags

Retrieve an existing tag
$tag = ActiveCampaign::tags()->get(100);
List all tags, optionally filtered by name
$tags = ActiveCampaign::tags()->list();
$filteredTags = ActiveCampaign::tags()->list('test_');
Create a tag
$tag = ActiveCampaign::tags()->create(
    name: 'test_tag',
    description: 'This is a new tag'
);
Update an existing tag
use RossBearman\ActiveCampaign\DataObjects\ActiveCampaignTag;

$tag = new ActiveCampaignTag(
    id: 100,
    name: 'test_tag',
    description: 'Another description',
);

ActiveCampaign::tags()->update($tag);
Delete an existing tag
ActiveCampaign::tags()->delete(100);

Messages

Retrieve an existing message
$message = ActiveCampaign::messages()->get('1');
List all messages, or filter messages by query defined criteria
$messages = ActiveCampaign::messages()->list();
$firstTenMessages = ActiveCampaign::messages()->list('limit=10');
Create a message

Any additional fields supported by the API, such as subject, preheader_text, name, text and html, can be passed via $attributes.

$messageId = ActiveCampaign::messages()->create(
    fromname: 'John Doe',
    fromemail: 'info@example.com',
    reply2: 'reply@example.com',
    attributes: [
        'subject' => 'Welcome aboard',
        'html' => '<p>Thanks for signing up.</p>',
    ],
);
Update an existing message

Only the writable fields (name, fromname, fromemail, reply2, subject, preheader_text, text and html) are sent to the API.

use RossBearman\ActiveCampaign\DataObjects\ActiveCampaignMessage;

$message = new ActiveCampaignMessage(
    id: '1',
    userid: null,
    name: 'Welcome email',
    fromname: 'John Doe',
    fromemail: 'info@example.com',
    reply2: 'reply@example.com',
    subject: 'A new subject',
    preheader_text: 'Thanks for signing up',
    text: 'Thanks for signing up.',
    html: '<p>Thanks for signing up.</p>',
    charset: null,
    encoding: null,
    format: null,
    priority: null,
    hidden: null,
    cdate: null,
    mdate: null,
);

ActiveCampaign::messages()->update($message);

Note that when a message is edited through the API, the ActiveCampaign preview window and email builder will not show the updated contents.

Delete an existing message
ActiveCampaign::messages()->delete('1');

Code Quality

./vendor/bin/phpstan analyse

License

MIT

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

651,963,193 9,701
laravel/framework

The Laravel Framework.

604,216,237 34,982
laravel/tinker

Powerful REPL for the Laravel framework.

518,004,183 7,444
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

435,097,283 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

407,699,310 4,663

Version History

Version Released PHP Laravel License
v1.3.4 ^8.1 ^10.0|^11.0|^12.0|^13.0 MIT
v1.3.3 ^8.1 ^10.0|^11.0|^12.0|^13.0 MIT
v1.3.2 ^8.1 ^10.0|^11.0|^12.0 MIT
v1.3.1 ^8.1 ^10.0 | ^11.0 MIT
v1.3.0 ^8.1 ^10.0 MIT