steadfastcollective/laravel-customer-io

Laravel的Customer.io通知通道

1.1.5 2021-02-15 10:06 UTC

This package is auto-updated.

Last update: 2024-09-15 17:50:46 UTC


README

Latest Version on Packagist Build Status Total Downloads StyleCI

此包使用Customer io API和Laravel轻松发送通知。

关于

Customer io通道使您能够将Laravel通知作为Customer io事件发送。可通知的模型数据也将与Customer io同步并保持最新。

安装

您可以通过composer安装此包

composer require steadfastcollective/laravel-customer-io

设置Customer io服务

您需要创建一个Customer io帐户才能使用此通道。在您的帐户中,您可以找到API密钥和站点ID。将它们放在您的.env文件中

CUSTOMER_IO_ENABLED=true
CUSTOMER_IO_SITE_ID=[SITE_ID]
CUSTOMER_IO_API_KEY=[API_KEY]
CUSTOMER_IO_MODEL=App\User

用法

将特性添加到您的可通知模型中

use Steadfastcollective\LaravelCustomerIo\Traits\SyncsToCustomerIo;

class User extends Authenticatable
{
    use Notifiable, SyncsToCustomerIo;
    
    // ...
}

向通知类添加customer io支持

use Steadfastcollective\LaravelCustomerIo\Channels\CustomerIoChannel;
    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return [
            CustomerIoChannel::class,
        ];
    }

    /**
     * Get the customer io representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function toCustomerIo($notifiable)
    {
        return [
            // ...
        ];
    }
}

使用单个命令同步所有customer.io客户

php artisan customer-io:sync-customers

测试

composer test

变更日志

有关最近更改的更多信息,请参阅CHANGELOG

贡献

有关详细信息,请参阅CONTRIBUTING

安全

如果您发现任何与安全相关的问题,请通过电子邮件dev@steadfastcollective.com而不是使用问题跟踪器。

鸣谢

许可

MIT许可(MIT)。有关更多信息,请参阅许可文件