Search by

rulecom / api-wrapper

Rule

Api wrapper for the RULE mailer.

Package info

github.com/rule/api-wrapper

pkg:composer/rulecom/api-wrapper

Statistics

Installs: 21 494

Dependents: 1

Suggesters: 0

Stars: 4

Open Issues: 2

v2.0.0 2026-11-17 08:57 UTC

README

Package wrapping an RULE Mailer api using an guzzlehttp client as backend for the requests

Installation

Regular composer installation supposed, like: composer require rulecom/api-wrapper

Integration with Laravel

Use src/LaravelServiceProvider.php to register API instances in your application. Create config/rule-api.php file for the API configuration.

Then you'll be able to disectly use configured API classes

use Rule\ApiWrapper\Api\V2\Subscriber\Subscriber;

class Foo
{
    private $subscriberApi;

    public function __construct(Subscriber $subscriberApi)
    {
        $this->subscriberApi = $subscriberApi;
    }

    public function createMeSomeSubscriber($params)
    {
        //... do something 
        $this->subscriberApi->create([
            'email' => $email,
            //... see docs for detailes
        ]);
    }
}

V3 resources are bound separately and always target the v3 endpoint, regardless of rule-api.api_version:

use Rule\ApiWrapper\Api\V3\Suppression\Suppression;

class Bar
{
    private $suppressionApi;

    public function __construct(Suppression $suppressionApi)
    {
        $this->suppressionApi = $suppressionApi;
    }

    public function suppress(string $email)
    {
        $this->suppressionApi->create([
            ['email' => $email],
        ]);
    }
}

Docs

For the docs please refer docs folder in this repository.