rogertiweb/sendpulse

此包的最新版本(1.3)没有可用的许可证信息。

SendPulse REST API 客户端用于 Laravel

1.3 2022-10-16 20:30 UTC

This package is auto-updated.

Last update: 2024-09-17 00:51:30 UTC


README

Laravel 9 的 Sendpulse API 包

安装

composer require rogertiweb/sendpulse

Rogertiweb\SendPulse\SendPulseProvider::class 添加到 providers

config/app.php

'providers' => [
    Rogertiweb\SendPulse\SendPulseProvider::class,
],

'aliases' => [
    'SendPulse' => Rogertiweb\SendPulse\SendPulse::class,
]

发布配置

php artisan vendor:publish --provider="Rogertiweb\SendPulse\SendPulseProvider" --tag="config"

在您的 .env 文件中设置 API 密钥变量

SENDPULSE_API_USER_ID=null
SENDPULSE_API_SECRET=null

API 使用方法

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

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

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

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