setono / sylius-klaviyo-plugin
Sylius 的 Klaviyo 集成
v0.3.6
2024-01-29 08:26 UTC
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
使用此插件将您的商店与 Klaviyo 集成。
安装
步骤 1: 下载插件
打开命令控制台,进入您的项目目录并执行以下命令以下载此插件的最新稳定版本
$ composer require setono/sylius-klaviyo-plugin
步骤 2: 启用插件
然后,通过将以下内容添加到项目 config/bundles.php
文件中注册的插件/包列表中启用插件
<?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], // ... ];
注意:您必须在网格包之前实例化插件,否则您将看到如下异常:您请求了不存在的参数 "setono_sylius_klaviyo.model.member_list.class"。
步骤 3: 导入路由
# config/routes/setono_sylius_klaviyo.yaml setono_sylius_klaviyo: resource: "@SetonoSyliusKlaviyoPlugin/Resources/config/routes.yaml"
如果您不使用本地化 URL,请使用此路由文件:@SetonoSyliusKlaviyoPlugin/Resources/config/routes_no_locale.yaml
步骤 4: 配置插件
# 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)%"
然后请记住设置以下环境变量:KLAVIYO_PUBLIC_TOKEN
和 KLAVIYO_PRIVATE_TOKEN
,分别使用相应的令牌。
步骤 5: 更新数据库模式
使用 Doctrine 迁移创建迁移文件并更新数据库。
$ bin/console doctrine:migrations:diff $ bin/console doctrine:migrations:migrate
步骤 6: 使用异步传输(可选,但推荐)
此插件中的所有命令都将扩展 CommandInterface。因此,您可以通过将以下内容添加到您的 信使配置 来轻松路由所有命令。
# 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.cn/doc/current/messenger.html#transports-async-queued-messages 'Setono\SyliusKlaviyoPlugin\Message\Command\CommandInterface': async
用法
设置完成后,您希望将通道与 Klaviyo 中的列表关联起来。转到 /admin/klaviyo/member-lists/
并同步列表。之后,编辑列表并启用列表上的通道。