artjoker/sendpulse-laravel

SendPulse REST API client for Laravel

v1.6 2022-04-02 16:00 UTC

This package is auto-updated.

Last update: 2024-10-30 02:16:11 UTC


README

Sendpulse API package for Laravel

Installation

composer require artjoker/sendpulse-laravel

Add Artjoker\SendpulseLaravel\SendPulseProvider::class to providers

config/app.php

'providers' => [
    Artjoker\SendpulseLaravel\SendPulseProvider::class,
],

'aliases' => [
    'SendPulse' => Artjoker\SendpulseLaravel\SendPulse::class,
]

Publish config

php artisan vendor:publish --provider="Artjoker\SendpulseLaravel\SendPulseProvider" --tag="config"

Set the api key variables in your .env file

SENDPULSE_API_USER_ID=null
SENDPULSE_API_SECRET=null

Usage API

https://sendpulse.com/ru/integrations/api

// From container
$api = app('sendpulse-laravel');
$books = $api->listAddressBooks();

// From facade
$books = \SendPulse::listAddressBooks();

// From dependency injection
public function getBooks(\Artjoker\SendpulseLaravel\Contracts\SendPulseApi $api)
{
    $books = $api->listAddressBooks();
}