承接 broken-titan/laravel-klaviyo-channel 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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.

统计信息

  • 总下载量: 8.78k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-08-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固