jeffersongoncalves / laravel-klaviyo
Laravel integration for the Klaviyo API
Package info
github.com/jeffersongoncalves/laravel-klaviyo
pkg:composer/jeffersongoncalves/laravel-klaviyo
Requires
- php: ^8.2
- illuminate/contracts: ^12.0|^13.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.0|^3.0
- laravel/pint: ^1.0
- orchestra/testbench: ^10.0|^11.0
- pestphp/pest: ^3.0|^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Laravel Klaviyo
Laravel integration for the Klaviyo API
Installation
You can install the package via composer:
composer require jeffersongoncalves/laravel-klaviyo
Configuration
Set your Klaviyo private API key in .env:
KLAVIYO_API_KEY=pk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Optionally publish the config file:
php artisan vendor:publish --tag="klaviyo-config"
Usage
use Jeffersongoncalves\LaravelKlaviyo\Facades\LaravelKlaviyo; // Profiles LaravelKlaviyo::createProfile(['email' => 'user@example.com', 'first_name' => 'Jane']); LaravelKlaviyo::getProfile($id); LaravelKlaviyo::updateProfile($id, ['first_name' => 'Jane']); LaravelKlaviyo::listProfiles(['filter' => 'equals(email,"user@example.com")']); // Lists $list = LaravelKlaviyo::createList('Newsletter'); LaravelKlaviyo::addProfilesToList($list['data']['id'], [$profileId]); LaravelKlaviyo::removeProfilesFromList($list['data']['id'], [$profileId]); LaravelKlaviyo::deleteList($list['data']['id']); // Events LaravelKlaviyo::createEvent('Placed Order', 'user@example.com', ['order_id' => 123], value: 49.90); // Campaigns, Flows, Metrics, Segments, Templates LaravelKlaviyo::listCampaigns(); LaravelKlaviyo::listFlows(); LaravelKlaviyo::updateFlow($flowId, 'live'); LaravelKlaviyo::listMetrics(); LaravelKlaviyo::listSegments(); LaravelKlaviyo::listTemplates();
All methods throw Jeffersongoncalves\LaravelKlaviyo\LaravelKlaviyoException on a failed API response.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email the author instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
