appventus / swiftmailerdbbundle
支持短信的SwiftMailer数据库缓存
Requires
- php: >=5.3.3
- swiftmailer/swiftmailer: >=4.2.0
- symfony/swiftmailer-bridge: >=2.1.0
- symfony/swiftmailer-bundle: >=2.1.0
This package is auto-updated.
Last update: 2023-08-09 10:35:12 UTC
README
此包简化了使用SwiftMailer和Symfony2将消息缓存到数据库的过程。
目前,它仅支持与Doctrine EntityManager和由此管理的实体一起使用。
安装
首先,将包添加到您的项目中。
通过Composer:
-
在您的composer.json要求部分添加以下行
{ "require": { "whiteoctober/swiftmailerdbbundle": "dev-master" } }
-
通过Composer下载包
$ php composer.phar update whiteoctober/swiftmailerdbbundle
通过deps文件:
-
在您的
deps
文件中添加以下行[WhiteOctoberSwiftMailerDBBundle] git=git://github.com/whiteoctober/WhiteOctoberSwiftMailerDBBundle.git target=/bundles/WhiteOctober/SwiftMailerDBBundle
Run the vendors script:
./bin/vendors install
-
将WhiteOctober命名空间添加到自动加载器中
// app/autoload.php $loader->registerNamespaces(array( 'WhiteOctober' => DIR.'/../vendor/bundles', ));
一旦您已将包下载到Symfony项目中,您需要将其添加到内核中,并添加一些配置参数,以便它知道您想使用哪个实体。
-
将包添加到您的应用程序内核中
// app/AppKernel.php public function registerBundles() { return array( // ... new WhiteOctober\SwiftMailerDBBundle\WhiteOctoberSwiftMailerDBBundle(), // ... ); }
-
在您的config.yml中配置
white_october_swift_mailer_db
服务white_october_swift_mailer_db: entity_class: 全路径到Mail实体
请阅读以下如何构建此实体。
-
告诉SwiftMailer使用数据库缓存
swiftmailer: spool: type: db
这就是包的安装和配置的全部内容。
邮件实体
您需要创建一个可以持久化的实体,并从包中的EmailInterface
接口扩展。目前,此包期望您的实体中有一个名为'status'的属性,因为该字段将被查询。
一旦您的实体设置完毕,请使用如上所述的完全命名空间路径在config.yml
配置文件中使用。