broken-titan/laravel-klaviyo-channel
Composer 安装命令:
composer require broken-titan/laravel-klaviyo-channel
包简介
Klaviyo notification channel for Laravel.
README 文档
README
This package makes it easy to integrate Laravel with Klaviyo for sending notifications via a channel.
Contents
Installation
Install this package with Composer:
composer require broken-titan/laravel-klaviyo-channel
Configuration
Before you may begin using the Klaviyo service, you must obtain a private and public API key from your Klayivo account settings. The key must be assigned to KLAVIYO_API_KEY and KLAVIYO_API_PUBLIC_KEY in your .env file.
You should also publish the config file that will generate klaviyo.php in your config folder.
Usage
Once installation is complete, you can send events to Klaviyo by creating standard Laravel notifications. For example:
namespace App\Notifications;
use Illuminate\Notifications\Notification;
use BrokenTitan\Klaviyo\Channels\KlaviyoChannel;
use BrokenTitan\Klaviyo\Messages\KlaviyoTrackMessage;
use DateTimeImmutable;
class UserCreated extends Notification {
/**
* Get the notification's delivery channels.
*
* @method via
* @param mixed $notifiable
* @return array
*/
public function via($notifiable) {
return [KlaviyoChannel::class];
}
/**
* Sends the notification to Klaviyo.
*
* @method toKlaviyo
* @param mixed $notifiable
* @return BrokenTitan\Klaviyo\Messages\KlaviyoTrackMessage
*/
public function toKlaviyo($notifiable) : KlaviyoTrackMessage {
$customerProperties = ['$email' => $notifiable->email];
$properties = ['user_id' => $notifiable->user_id];
return new KlaviyoTrackMessage("User Created", $customerProperties, $properties, new DateTimeImmutable);
}
}
There are multiple notification message types you may return in toKlayivo: KlaviyoTrackMessage, KlaviyoTrackOnceMessage, KlaviyoIdentifyMessage. Using one or the other will produce the appropriate event for Klaviyo. See the method parameters for the appropriate arguments to pass.
Testing
$ composer test
Security
If you discover any security issues that would affect existing users, please email contact@broken-titan.com instead of using the issue tracker.
Contributing
Feel free to contribute to the package.
Credits
License
The MIT License (MIT). Please see License File for more information.
broken-titan/laravel-klaviyo-channel 适用场景与选型建议
broken-titan/laravel-klaviyo-channel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.78k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 08 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 broken-titan/laravel-klaviyo-channel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 broken-titan/laravel-klaviyo-channel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 8.78k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-08-23