setono / sylius-klaviyo-plugin
Klaviyo integration for Sylius
Installs: 5 637
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 4
Open Issues: 8
Type:sylius-plugin
Requires
- php: >=7.4
- doctrine/collections: ^1.6
- doctrine/orm: ^2.14
- knplabs/knp-menu: ^3.2
- liip/imagine-bundle: ^2.6
- matomo/device-detector: ^4.4 || ^5.0
- psr/cache: ^1.0 || ^2.0 || ^3.0
- psr/container: ^1.1
- psr/event-dispatcher: ^1.0
- psr/log: ^1.1 || ^2.0 || ^3.0
- setono/client-id-bundle: ^0.2.0
- setono/client-id-contracts: ^0.2
- spatie/data-transfer-object: ^1.14 || ^2.8
- sylius/channel: ^1.0
- sylius/channel-bundle: ^1.0
- sylius/core: ^1.0
- sylius/core-bundle: ^1.0
- sylius/customer: ^1.0
- sylius/order: ^1.0
- sylius/product: ^1.0
- sylius/resource-bundle: ^1.6
- sylius/ui-bundle: ^1.0
- symfony/config: ^5.4 || ^6.0
- symfony/console: ^5.4 || ^6.0
- symfony/dependency-injection: ^5.4 || ^6.0
- symfony/event-dispatcher: ^5.4 || ^6.0
- symfony/form: ^5.4 || ^6.0
- symfony/http-client: ^5.4 || ^6.0
- symfony/http-client-contracts: ^2.4 || ^3.3
- symfony/http-foundation: ^5.4 || ^6.0
- symfony/http-kernel: ^5.4 || ^6.0
- symfony/messenger: ^5.4 || ^6.0
- symfony/routing: ^5.4 || ^6.0
- symfony/serializer: ^5.4 || ^6.0
- webmozart/assert: ^1.10
Requires (Dev)
- api-platform/core: ^2.6
- friendsofsymfony/oauth-server-bundle: >2.0.0-alpha.0 ^2.0@dev
- lexik/jwt-authentication-bundle: ^2.14
- matthiasnoback/symfony-config-test: ^4.3
- matthiasnoback/symfony-dependency-injection-test: ^4.3
- php-http/message-factory: ^1.1
- phpunit/phpunit: ^9.6
- psalm/plugin-phpunit: ^0.18
- setono/code-quality-pack: ^2.4
- sylius/admin-api-bundle: ^1.10
- sylius/sylius: ~1.10.14
- symfony/debug-bundle: ^5.4 || ^6.0
- symfony/dotenv: ^5.4 || ^6.0
- symfony/intl: ^5.4 || ^6.0
- symfony/property-info: ^5.4 || ^6.0
- symfony/web-profiler-bundle: ^5.4 || ^6.0
- symfony/webpack-encore-bundle: ^1.12
README
Use this plugin to integrate your store with Klaviyo.
Installation
Step 1: Download the plugin
Open a command console, enter your project directory and execute the following command to download the latest stable version of this plugin:
$ composer require setono/sylius-klaviyo-plugin
Step 2: Enable the plugin
Then, enable the plugin by adding the following to the list of registered plugins/bundles
in the config/bundles.php
file of your project:
<?php return [ // ... Setono\SyliusKlaviyoPlugin\SetonoSyliusKlaviyoPlugin::class => ['all' => true], // It is important to add plugin before the grid bundle Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true], // ... ];
NOTE that you must instantiate the plugin before the grid bundle, else you will see an exception like
You have requested a non-existent parameter "setono_sylius_klaviyo.model.member_list.class".
Step 3: Import routing
# config/routes/setono_sylius_klaviyo.yaml setono_sylius_klaviyo: resource: "@SetonoSyliusKlaviyoPlugin/Resources/config/routes.yaml"
If you don't use localized URLs, use this routing file instead: @SetonoSyliusKlaviyoPlugin/Resources/config/routes_no_locale.yaml
Step 4: Configure plugin
# config/packages/setono_sylius_klaviyo.yaml imports: - { resource: "@SetonoSyliusKlaviyoPlugin/Resources/config/app/config.yaml" } setono_sylius_klaviyo: credentials: public_token: "%env(KLAVIYO_PUBLIC_TOKEN)%" private_token: "%env(KLAVIYO_PRIVATE_TOKEN)%"
Then remember to set these environment variables: KLAVIYO_PUBLIC_TOKEN
and KLAVIYO_PRIVATE_TOKEN
with the respective tokens.
Step 5: Update database schema
Use Doctrine migrations to create a migration file and update the database.
$ bin/console doctrine:migrations:diff $ bin/console doctrine:migrations:migrate
Step 6: Using asynchronous transport (optional, but recommended)
All commands in this plugin will extend the CommandInterface. Therefore you can route all commands easily by adding this to your Messenger config:
# config/packages/messenger.yaml framework: messenger: routing: # Route all command messages to the async transport # This presumes that you have already set up an 'async' transport # See docs on how to setup a transport like that: https://symfony.com/doc/current/messenger.html#transports-async-queued-messages 'Setono\SyliusKlaviyoPlugin\Message\Command\CommandInterface': async
Usage
After setup you want to associate channels with lists in Klaviyo. Go to /admin/klaviyo/member-lists/
and synchronize the lists. After that edit the lists and enable channels on the lists.