官方英文资料(未自动翻译);本文按官方对应版本整理,保留说明和代码。站内处理包括移除站点导航、还原代码格式及调整链接。
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
UnsupportedSchemeExceptionclass of the component and to itsUnsupportedSchemeExceptionTesttest class; - For Mailer and Notifier bridges, add the new transport factory to the
FACTORY_CLASSESconstant of the component'sTransportclass; - Register the new factory service in the related FrameworkBundle config file
(
mailer_transports.php,notifier_transports.phportranslation_providers.php) and add its class to the$classToServiceslist 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
LICENSEfile.
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.
来源与许可
Symfony documentation contributors。本资料采用 CC BY-SA 3.0;本页为官方资料的站内整理版本,并非框架官方网站。 许可说明