steadfastcollective / laravel-customer-io
Customer.io notification channel for Laravel
Installs: 3 623
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 2
Open Issues: 1
Requires
- php: ^7.2.5
- illuminate/support: ^7.0|^8.0
- printu/customerio: ^3.0
Requires (Dev)
- mockery/mockery: ^1.3
- orchestra/testbench: ^5.1|^6.0
- phpunit/phpunit: ^8.0
README
This package makes it easy to send notifications using the Customer io API with Laravel.
About
The Customer io channel makes it possible to send out Laravel notifications as a Customer io event. The notifiable model data will also be synced with Customer io and kept up to date.
Installation
You can install the package via composer:
composer require steadfastcollective/laravel-customer-io
Setting up the Customer io service
You will need to create a Customer io account to use this channel. Within your account, you will find the API key and the site ID. Place them inside your .env file:
CUSTOMER_IO_ENABLED=true
CUSTOMER_IO_SITE_ID=[SITE_ID]
CUSTOMER_IO_API_KEY=[API_KEY]
CUSTOMER_IO_MODEL=App\User
Usage
Add the trait to your notifiable model:
use Steadfastcollective\LaravelCustomerIo\Traits\SyncsToCustomerIo; class User extends Authenticatable { use Notifiable, SyncsToCustomerIo; // ... }
Adding customer io support to the notification class:
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 [ // ... ]; } }
Sync all customers with customer.io with a single command:
php artisan customer-io:sync-customers
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email dev@steadfastcollective.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.