Add Active Campaign API v3 to your Laravel application.

Overview

Laravel ActiveCampaign (WIP)

Latest Stable Version MIT Licensed Quality Score Total Downloads

This package provides a simple interface to the ActiveCampaign API v3.

Currently the packages only supports the endpoints Contacts, Custom Fields Values and Tags. Feel free to PR the remaining endpoints.

Requirements

  • PHP 8.x
  • Laravel 9.x

Installation

1. Install the package via composer

composer require label84/laravel-active-campaign

2. Publish the config file

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

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

ACTIVE_CAMPAIGN_BASE_URL=
ACTIVE_CAMPAIGN_API_KEY=

Usage

Contacts

Retreive an existing contact by their id

use Label84\ActiveCampaign\ActiveCampaign;

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

List all contact, search contacts, or filter contacts by query defined criteria

use Label84\ActiveCampaign\ActiveCampaign;

$contacts = resolve(ActiveCampaign::class)->contacts()->list('[email protected]');

Create a contact and get the contact id

use Label84\ActiveCampaign\ActiveCampaign;

$contactId = resolve(ActiveCampaign::class)->contacts()->create('[email protected]', [
    'firstName' => 'John',
    'lastName' => 'Doe',
    'phone' => '+3112345678',
]);

Update an existing contact

use Label84\ActiveCampaign\ActiveCampaign;
use Label84\ActiveCampaign\DataObjects\ActiveCampaignContact;

$contact = new ActiveCampaignContact(1, '[email protected]', '+3112345678', 'John', 'Deer');

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

Delete an existing contact by their id

use Label84\ActiveCampaign\ActiveCampaign;

resolve(ActiveCampaign::class)->contacts()->delete(1);

Custom Field Values

Retreive an existing field value by their id

use Label84\ActiveCampaign\ActiveCampaign;

$fieldValue = resolve(ActiveCampaign::class)->fieldValues()->get(50);

Create a field value and get the id

use Label84\ActiveCampaign\ActiveCampaign;

$fieldValue = resolve(ActiveCampaign::class)->fieldValues()->create(1, 50, 'active');

Update an existing field value

use Label84\ActiveCampaign\ActiveCampaign;
use Label84\ActiveCampaign\DataObjects\ActiveCampaignFieldValue;

$fieldValue = new ActiveCampaignFieldValue(1, 50, 'inactive');

$fieldValue = resolve(ActiveCampaign::class)->fieldValues()->update($fieldValue);

Delete an existing field value by their id

use Label84\ActiveCampaign\ActiveCampaign;

resolve(ActiveCampaign::class)->fieldValues()->delete(50);

Tags

Retreive an existing tag by their id

use Label84\ActiveCampaign\ActiveCampaign;

$tag = resolve(ActiveCampaign::class)->tags()->get(100);

List all tags filtered by name

use Label84\ActiveCampaign\ActiveCampaign;

$tags = resolve(ActiveCampaign::class)->tags()->list('abc');

Create a tag and get the id

use Label84\ActiveCampaign\ActiveCampaign;

$tag = resolve(ActiveCampaign::class)->tags()->create('test_tag', 'This is a new tag');

Update an existing tag

use Label84\ActiveCampaign\ActiveCampaign;
use Label84\ActiveCampaign\DataObjects\ActiveCampaignTag;

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

$tag = resolve(ActiveCampaign::class)->tags()->update($tag);

Delete an existing tag by their id

use Label84\ActiveCampaign\ActiveCampaign;

resolve(ActiveCampaign::class)->tags()->delete(100);

Tests

./vendor/bin/phpstan analyse

License

MIT

You might also like...
Add Webhooks to your Laravel app, arrr
Add Webhooks to your Laravel app, arrr

# Captain Hook ## Add Webhooks to your Laravel app, arrr Implement multiple webhooks into your Laravel app using the Laravel Event system. A webhook i

Easily add all the 58 Algerian Wilayas and its Dairas to your cool Laravel project (Migrations, Seeders and Models).
Easily add all the 58 Algerian Wilayas and its Dairas to your cool Laravel project (Migrations, Seeders and Models).

Laravel-Algereography Laravel-Algereography allows you to add Migrations, Seeders and Models of Algerian Wilayas and Dairas to your existing or new co

This package helps you to add user based follow system to your model.

Laravel Follow User follow unfollow system for Laravel. Related projects: Like: overtrue/laravel-like Favorite: overtrue/laravel-favorite Subscribe: o

An easy way to add colors in your CLI scripts.
An easy way to add colors in your CLI scripts.

COLORS Here is a preview of what you can achieve with the library: Installation Installation via composer is highly recommended. { "require": {

Add internal link to your published assets.

WORK IN PROGRESS, some functionalities may be changed in the future. Add internal link to your published assets. Installation You can install the pack

Custom Blade components to add sortable/drag-and-drop HTML elements in your apps.
Custom Blade components to add sortable/drag-and-drop HTML elements in your apps.

Laravel Blade Sortable Demo Repo Installation You can install the package via composer: composer require asantibanez/laravel-blade-sortable After the

Add a general-purpose tools page to your Filament project. 🛠
Add a general-purpose tools page to your Filament project. 🛠

Add a general-purpose tools page to your Filament project. Installation You can install the package via Composer: composer require ryangjchandler/fila

Add a progress bar column to your Filament tables.
Add a progress bar column to your Filament tables.

Add a progress bar column to your Filament tables. This package provides a ProgessColumn that can be used to display a progress bar in a Filament tabl

Laravel 2-Step Verification is a package to add 2-Step user authentication to any Laravel project easily.
Laravel 2-Step Verification is a package to add 2-Step user authentication to any Laravel project easily.

Laravel 2-Step verification is a package to add 2-Step user authentication to any Laravel project easily. It is configurable and customizable. It uses notifications to send the user an email with a 4-digit verification code. Laravel 2-Step Authentication Verification for Laravel. Can be used in out the box with Laravel's authentication scaffolding or integrated into other projects.

Comments
  • Need to help understanding how this works

    Need to help understanding how this works

    Hi!

    I previously installed ActiveCampaign in another php framework with the AC php wrapper. But I need to install this in Laravel now and this package seems interesting. I do have a few questions:

    • From the document (and the code), it seems like settings a value to a custom field requires the id of the field. But why would I list my custom fields in the config file if we are not using those ids? (I am probably missing one step)
    • Can I only set values on custom fields 1 by 1? It doesn't seems like I can create the contact with the custom fields, nor can I send multiple values at the same time?

    Thanks for your help !

    Ed

    opened by heyddi 1
  • Bump version number

    Bump version number

    Hello, after installing the package it's not possible to publish the config file because the version number wasn't updated after the last commits. Can you do that ? Thanks in advance.

    opened by sdebacker 1
  • Update ActiveCampaignServiceProvider.php

    Update ActiveCampaignServiceProvider.php

    This makes to the publish config command works: php artisan vendor:publish --provider="Label84\ActiveCampaign\ActiveCampaignServiceProvider" --tag="config"

    opened by Jakoffe 1
Releases(v1.1.0)
Owner
Label84
Label84
Framework agnostic PHP package for marking navigation items active.

Ekko Framework agnostic PHP package for marking navigation items active. Features Framework agnostic. Can be modified for any custom application and U

Laravelista 275 Jul 27, 2022
PHP phonebook with map (Active Directory, LDAP -> MySQL, PHP)

LDAP phonebook ???? ???? Development ветка Вопросы предпочтительнее задавать в Issues, а не по почте Корпоративный телефонный справочник с отображение

null 47 Nov 30, 2022
Laravel-tagmanager - An easier way to add Google Tag Manager to your Laravel application.

Laravel TagManager An easier way to add Google Tag Manager to your Laravel application. Including recommended GTM events support. Requirements Laravel

Label84 16 Nov 23, 2022
A Laravel package helps you add a complete real-time messaging system to your new / existing application with only one command.

A Laravel package helps you add a complete real-time messaging system to your new / existing application with only one command.

Munaf Aqeel Mahdi 1.7k Jan 5, 2023
`dd` is a helper method in Laravel. This package will add the `dd` to your application.

dd dd is a helper method in Laravel. This package will add the dd to your application. Install Run composer require larapack/dd 1.* For Laravel Larave

Larapack 109 Dec 26, 2022
Laravel Breadcrumbs - An easy way to add breadcrumbs to your @Laravel app.

Introduction Breadcrumbs display a list of links indicating the position of the current page in the whole site hierarchy. For example, breadcrumbs lik

Alexandr Chernyaev 269 Dec 21, 2022
Easily add a full Laravel blog (with built in admin panel and public views) to your laravel project with this simple package.

Webdevetc BlogEtc - Complete Laravel Blog Package Quickly add a blog with admin panel to your existing Laravel project. It has everything included (ro

WebDevEtc. 227 Dec 25, 2022
Add tags and taggable behaviour to your Laravel app

Add tags and taggable behaviour to a Laravel app This package offers taggable behaviour for your models. After the package is installed the only thing

Spatie 1.4k Dec 29, 2022
This package lets you add uuid as primary key in your laravel applications

laravel-model-uuid A Laravel package to add uuid to models Table of contents Installation Configuration Model Uuid Publishing files / configurations I

salman zafar 10 May 17, 2022
Add Server-Timing header information from within your Laravel apps.

Laravel Server Timings Add Server-Timing header information from within your Laravel apps. Installation You can install the package via composer: comp

Beyond Code 498 Dec 15, 2022