andreas-glaser / notify-bundle
该软件包已被弃用且不再维护。未建议替代软件包。
一个symfony扩展包,简化发送电子邮件、短信和其他通知的过程
dev-master / 1.0.x-dev
2017-05-25 07:28 UTC
Requires
- php: ^7
- andreas-glaser/php-helpers: @stable
- symfony/symfony: 2.8.*
Requires (Dev)
- phpunit/phpunit: @stable
- symfony/phpunit-bridge: ^3.2
- symfony/var-dumper: @stable
This package is auto-updated.
Last update: 2023-11-05 02:28:19 UTC
README
一个symfony扩展包,简化发送电子邮件、短信和其他通知的过程
要求
- PHP 7.x
- Symfony 2.8.x LTS
安装
composer require andreas-glaser/notify-bundle dev-master
使用
定义电子邮件
# app/config/config.yml andreas_glaser_notify: enabled: true channels: email: from_name: "Default Name" from_email: "my-default-from-email@email.com" emails: example_email: subject: Welcome :name" template_content: "AppBundle:Email:exampleEmail.html.twig"
运行以下控制台命令以获取完整配置选项列表。
./app/console config:dump-reference andreas_glaser_notify
发送电子邮件
<?php $subjectData = [ ':name' => 'Some name' ]; $bodyData = []; /** @var \AndreasGlaser\NotifyBundle\Channel\Email\Email $email */ $email = $this ->container ->get('andreas_glaser_notify.channel_email.loader') ->load('example_email', $bodyData, $subjectData); $this->container ->get('andreas_glaser_notify.channel.email.dispatcher') ->dispatch($email);