rpwebdevelopment / laravel-blueshift
为 Laravel 设计的 Blueshift 集成包
v0.1.3
2022-04-13 13:25 UTC
Requires
- php: ^7.4
- ext-curl: *
- ext-json: *
- guzzlehttp/guzzle: ^7.0
- illuminate/contracts: ^8.53
- spatie/laravel-package-tools: ^1.9.2
Requires (Dev)
- nunomaduro/collision: ^5.3
- orchestra/testbench: ^6.15
- phpunit/phpunit: ^9.3
- slevomat/coding-standard: ^7.0
- spatie/laravel-ray: ^1.26
- squizlabs/php_codesniffer: ^3.6
This package is auto-updated.
Last update: 2024-09-09 15:14:44 UTC
README
这是一个特定于 Laravel 的包,旨在使与 Blueshift API 的通信快速简便。
需求
目前此包仅在 Laravel 8.* 上运行
安装
您可以通过 composer 安装此包
composer require rpwebdevelopment/laravel-blueshift
用法
配置
在库可以正常工作之前,它期望提供 blueshift 配置。此包提供了一个基础版本的配置,您可以通过运行以下命令来安装:
php artisan vendor:publish --tag=blueshift-config
基础配置从环境(env)中提取值以填充配置。
BLUESHIFT_API_KEY
- 这应该是 Blueshift 提供的 "用户 API 密钥"。BLUESHIFT_BASE_URL
- 默认为 'https://api.eu.getblueshift.com',对于非欧盟地区,此值应设置为 'https://api.getblueshift.com'
类结构
laravel-blueshift 提供了用于处理不同 API 端点的特定类,以下列出可用的类及其方法:
- BlueshiftCustomer
- search(string $email);
- get(string $uuid);
- createJson(string $customer);
- createArray(array $customer);
- bulkCreateJson(string $customers);
- bulkCreateArray(array $customers);
- manageCustomerSubscriptions(?string $email = null, ?string $uuid = null, bool $unsubscribedEmail = false, bool $unsubscribedPush = false, bool $unsubscribedSms = false);
- unsubscribeCustomerFromEmail(?string $email = null, ?string $uuid = null);
- unsubscribeCustomerFromSms(?string $email = null, ?string $uuid = null);
- unsubscribeCustomerFromPush(?string $email = null, ?string $uuid = null);
- unsubscribeCustomerFromAll(?string $email = null, ?string $uuid = null);
- manageEmailListSubscriptions(array $emailList, ?bool $unsubscribedEmail = null, ?bool $unsubscribedPush = null, ?bool $unsubscribedSms = null);
- startTracking(?string $email, ?string $uuid);
- stopTracking(?string $email, ?string $uuid);
- delete(?string $email, ?string $uuid, bool $allMatching)
- BlueshiftCatalog
- createCatalog(string $name);
- getList();
- addItems(string $uuid, array $items);
- getCatalog(string $uuid);
- BlueshiftUserList
- createList(string $name, string $description, string $source = 'email');
- addUserToList(int $listId, string $identifierKey, string $identifierValue);
- removeUserFromList(int $listId, string $identifierKey, string $identifierValue);
- BlueshiftEvent
- sendEvent(array $event);
从您的 Laravel 应用程序中,可以按照以下方式调用这些方法:
try { $customer = app(BlueshiftCustomer::class)->search('email_address@example.org'); } catch (\Exception $e) { }
测试
composer test
更新日志
请参阅 CHANGELOG 了解最近的变化。
鸣谢
许可
MIT 许可证 (MIT)。请参阅 许可文件 了解更多信息。