oscar-team/customerio-laravel
Composer 安装命令:
composer require oscar-team/customerio-laravel
包简介
Package will be used to create customers and events on Customer.io using Laravel
README 文档
README
Package is used to create/update customer and events for customer on Customer.io
Package is using printu/customerio package.
Installtion
composer require oscar-team/customerio-laravel
You can also publish the config file with:
php artisan vendor:publish --tag=customerio-config
Generate Site ID, API Key and App API Key from Customer.io and setup variables in .env file.
CUSTOMER_IO_DEFAULT_WORKSPACE=VALUE CUSTOMER_IO_SITE_ID=VALUE CUSTOMER_IO_API_KEY=VALUE CUSTOMER_IO_APP_API_KEY=VALUE
If you want to setup more workspaces to connect to, then you need to copy the add them into config/customerio.php in the workspaces key.
Each workspace needs to have these 3 keys: api_key, app_api_key, site_id.
Usage
Include use Oscar\CustomerioLaravel\Facades\CustomerIo; in your controller and add following function.
Create customer.io object
$customerIo = CustomerIo::workspace();
or
$customerIo = CustomerIo::workspace('us_market');
Search Customer by Email
$isCustomer = $customerIo->searchCustomerByEmail($email);
Create Customer
email is required to create customer and id is option but cannot be null. It is possible to add more attributes you want to add for customer.
$customerData = [ 'id' => 1 'email' => 'demo@test.com', 'first_name' => 'john', 'last_name' => 'doe', ]; $customerIo->addCustomer($customerData);
Update Customer
email is required to create customer and id is option but cannot be null.
$customerData = [ 'id' => 1 'email' => 'demo@test.com', 'first_name' => 'Doe', 'last_name' => 'John', ]; $customerIo->updateCustomer($customerData);
Create Event
While creating and event, id or email is used to link the event with customer, for
$eventData = [ 'id' => 1 'email' => 'demo@test.com', 'name' => 'Event Created', 'data' => [] ]; $customerIo->createEvent($eventData);
Send email
$emailData = [ 'transactional_message_id' => 123, // can also be a string depending how the template is configured in Customer.io 'identifiers' => [ // you need to send only one of these, depending which one you want and use in Customer.io 'id' => 'your_own_custom_id_in_cio', 'email' => 'demo@test.com', 'cio_id' => 'customer_id_generated_by_cio', ], 'to' => '\"Destination Person\" <destination-person@example.com>', 'body' => '<p>This is my test email</p>', // required if 'transactional_message_id' is not provided; will override the body of the template if both are passed 'subject' => 'Subject for my test email', // required if 'transactional_message_id' is not provided; will override the subject of the template if both are passed 'from' => '\"Sender Person\" <sender-person@example.com>', // required if 'transactional_message_id' is not provided; will override the from of the template if both are passed 'message_data' => [ '<parameterName>' => '<parameterValue>' // key-value pair for each parameter you have in the template. replaced `<parameterName>` with the actual name of the parameter and `<parameterValue>` with the actual value of the parameter ], ];
oscar-team/customerio-laravel 适用场景与选型建议
oscar-team/customerio-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11.97k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2023 年 03 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 oscar-team/customerio-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 oscar-team/customerio-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 11.97k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-03-27