Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Kris01's avatar

Active Campaign API - List tags, cotacts

Hello guys, am using this package https://github.com/Label84/laravel-active-campaign to make it easier with Active Campaign, but when I am trying to list the tags or contacts it throws syntax error, unexpected identifier "int", expecting variable

I am basically following the documentation of the package but I keep getting this error.

Package I use says to do

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

API Documentation on list tags https://developers.activecampaign.com/reference/retrieve-all-tags

0 likes
5 replies
Kris01's avatar

@webrobert nope, used just as an example, in my actual code I do list a tag that I have created on active campaign

1 like
Kris01's avatar

@webrobert I found the bug inside the library but I would need a hand, the problem is the following

This is the list contact function of the library

   /**
     * List all contact, search contacts, or filter contacts by query defined criteria.
     *
     * @return Collection<int, ActiveCampaignContact>
     */
    public function list(?string $query = ''): Collection
    {
        $contacts = $this->request(
            method: 'get',
            path: 'contacts?'.$query,
            responseKey: 'contacts'
        );

        return collect($contacts)
            ->map(fn ($contact) => ContactFactory::make($contact));
    }

That ActiveCampaignContact collection that returns is a DataObject

<?php

namespace Label84\ActiveCampaign\DataObjects;

class ActiveCampaignContact
{
    public function __construct(
        public readonly int $id,
        public readonly string $email,
        public readonly ?string $phone,
        public readonly ?string $firstName,
        public readonly ?string $lastName,
    ) {
    }
}

And the problem that I get in the logs when I call the list function points here in this construct.

How could I fix this?

1 like
Kris01's avatar

In the end I switched to guzzle, this package had some problems

1 like
webrobert's avatar
Level 51

@Kris01 good to know. I was going for say. I often will use the http client to just make the methods I need.

Please or to participate in this conversation.