mailerlite / mailerlite-api-v2-php-sdk

Official PHP wrapper for MailerLite Classic HTTP API v2
https://developers-classic.mailerlite.com/docs
MIT License
80 stars 44 forks source link

How to get all active subscribers? #39

Closed hifall closed 4 years ago

hifall commented 4 years ago

I am trying to get all active subscribers using this code:

    $mailerliteClient = new \MailerLiteApi\MailerLite($apiKey);
    $subscribersApi = $mailerliteClient->subscribers()
                                       ->where([
                                           'type' => 'active'
                                       ]);

But it returns all the subscribers, including unsubscribed.

How can I get all active subscribers?

dominykasmailer commented 4 years ago

Hello @hifall ,

In the new version of SDK you would just do:

$mailerliteClient = new \MailerLiteApi\MailerLite($apiKey);
$subscribersApi = $mailerliteClient->subscribers()->get(['*'], \MailerLiteApi\Api\Subscribers::TYPE_ACTIVE);
a-frolov-paysera commented 2 years ago
$groups = $this->groupsApi->where(
            [
                'name' => [
                    'like' => 'some string',
                ],
            ]
        )->get();

return 500 error

a-frolov-paysera commented 2 years ago
$groups = $this->groupsApi->where(
            [
                'name' => [
                    '$like' => '%string%',
                ],
            ]
        )->get();

Such works