首页>开发手册>Symfony>Creating a New Mailer, Notifier or Translation Bridge
Symfony 手册目录展开/收起

Symfony 7.4 LTS

Creating a New Mailer, Notifier or Translation Bridge

本文目录展开

官方英文资料(未自动翻译);本文按官方对应版本整理,保留说明和代码。站内处理包括移除站点导航、还原代码格式及调整链接。

Creating a new bridge for the Mailer, Notifier or Translation components requires changes in several places of the Symfony code, the Symfony Flex recipes and the Symfony documentation. Use the following checklist to make sure you don't forget any of them.

Update the Code

  • Add the new bridge to the UnsupportedSchemeException class of the component and to its UnsupportedSchemeExceptionTest test class;
  • For Mailer and Notifier bridges, add the new transport factory to the FACTORY_CLASSES constant of the component's Transport class;
  • Register the new factory service in the related FrameworkBundle config file (mailer_transports.php, notifier_transports.php or translation_providers.php) and add its class to the $classToServices list of the related method in FrameworkExtension;
  • Add the #[\SensitiveParameter] attribute to the arguments that contain sensitive information (API keys, passwords, tokens, etc.);
  • Use the current year in the copyright notice of the LICENSE file.

Update the Recipes

Add a Symfony Flex recipe for the new bridge to the symfony/recipes repository, so the needed environment variables (e.g. the DSN) are added to the .env file of the application when installing the bridge.

Update the Documentation

Each bridge is documented in its own README.md file, so explain there how to configure and use it. However, you must also update the following parts of the component documentation.

For a Mailer bridge:

  • Add the new bridge to the list of third-party transports;
  • Add its available DSN formats to the list of DSN formats of that same section;
  • If the new bridge supports tags and metadata, add it to the list of transports that support them in the Mailer docs;
  • If the new bridge supports webhooks, add it to the list of providers in the Webhook docs.

For a Notifier bridge:

  • Add the new bridge to the list of the related Notifier channel (SMS, chat, push, etc.);
  • If the new bridge supports webhooks, add it to the list of providers in the Webhook docs.

For a Translation bridge:

  • Add the new bridge to the list of translation providers;
  • Add its available DSN formats to the list of DSN formats of that same section.
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.
TOC
Version

来源与许可

Symfony documentation contributors。本资料采用 CC BY-SA 3.0;本页为官方资料的站内整理版本,并非框架官方网站。 许可说明

Symfony 官方文档 · 原文来源 · 打开在线代码运行