Pular para o conteúdo
← Voltar para projetos

Laravel Klaviyo

Laravel integration for the Klaviyo API

Laravel Klaviyo

#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.

Nova versão disponível.