synolia/sylius-mail-tester-plugin 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

synolia/sylius-mail-tester-plugin

Composer 安装命令:

composer require synolia/sylius-mail-tester-plugin

包简介

Mail Tester Plugin.

README 文档

README

License CI - Analysis CI - Sylius Version Total Downloads

Sylius Logo.

Mail Tester Plugin

Test how your emails are rendered by sending them to your email from your Sylius admin panel.

Capture SentEmail

Features

  • See a list of all sylius emails
  • Send example email one by one to your email address
  • Send all example emails to your email address
  • For each email, you have to select the entity to be used in the template.

Requirements

Version
PHP ^8.2
Sylius ^2.0

Installation

  1. Add the bundle and dependencies in your composer.json :

    $ composer require synolia/sylius-mail-tester-plugin
  2. Enable the plugin in your config/bundles.php file by add

    Synolia\SyliusMailTesterPlugin\SynoliaSyliusMailTesterPlugin::class => ['all' => true],
  3. Create a new file config/routes/mailtester.yaml with:

    synolia_mail_tester:
        resource: "@SynoliaSyliusMailTesterPlugin/config/routes/admin_routing.yaml"
        prefix: '/%sylius_admin.path_name%'
  4. Import the plugin configuration:

    # config/packages/mailtester.yaml
    imports:
        - { resource: "@SynoliaSyliusMailTesterPlugin/config/config.yaml" }

Usage

  • Log into admin panel
  • Click on Mail tester in the Configuration section in main menu
  • Enter the email address that will receive the example email template
  • Select the email you would like to be sent.
  • Click on Choose subject
  • Fill empty boxes and select your entities.
  • Click the Submit button.

Allow sending your custom emails

In order to be able to send a custom email with variables, you have to add a form type that will add those variables to the form. The important part is that your Form Type must implement ResolvableFormTypeInterface in order to be discovered by our FormTypeResolver.

<?php

declare(strict_types=1);

namespace Synolia\SyliusMailTesterPlugin\Form\Type;

use Sylius\Component\Core\Model\Order;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Synolia\SyliusMailTesterPlugin\Resolver\ResolvableFormTypeInterface;

public class CustomEmailType extends AbstractType implements ResolvableFormTypeInterface
{
    /** @var string */
    private const SYLIUS_EMAIL_KEY = 'custom_email'; //this should match your email identification key in sylius_mailer.yaml.

    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        parent::buildForm($builder, $options);

        /**
         * The key 'order' represent the name of the variable in your template.
         * Then you specify the type of the variable.
         * In this example we provide a list of all available orders.
         */
        $builder->add('order', EntityType::class, [
            'class' => Order::class,
            'choice_label' => 'number',
        ]);
    }

    public function support(string $emailKey): bool
    {
        return $emailKey === self::SYLIUS_EMAIL_KEY;
    }

    public function getCode(): string
    {
        return self::SYLIUS_EMAIL_KEY;
    }

    public function getFormType(string $emailKey): ResolvableFormTypeInterface
    {
        return $this;
    }
}

Development

See How to contribute.

License

This library is under the MIT license.

Credits

Developed by Synolia.

synolia/sylius-mail-tester-plugin 适用场景与选型建议

synolia/sylius-mail-tester-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 149.94k 次下载、GitHub Stars 达 14, 最近一次更新时间为 2020 年 01 月 27 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「mail」 「sylius」 「tester」 「sylius-plugin」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 synolia/sylius-mail-tester-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 synolia/sylius-mail-tester-plugin 我们能提供哪些服务?
定制开发 / 二次开发

基于 synolia/sylius-mail-tester-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 149.94k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 14
  • 点击次数: 14
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 14
  • Watchers: 11
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-01-27