tss / automailer-bundle
将 Doctrine spool 添加到 Swiftmailer
v1.2.1
2016-06-08 13:56 UTC
Requires
- php: >=5.3.2
- swiftmailer/swiftmailer: >=4.2.0
- symfony/swiftmailer-bridge: >=2.1
- symfony/swiftmailer-bundle: >=2.1.0
Suggests
- beanstalkd-binary: http://kr.github.com/beanstalkd/
- leezy/pheanstalk-bundle: Allows integration with beanstalk queue, through internal BeanstalkPlugin
This package is not auto-updated.
Last update: 2024-09-18 14:56:51 UTC
README
Swiftmailer Spool for Doctrine 打包成 Symfony2 Bundle
安装说明
- 最简单的安装方法是使用 composer,将这些行添加到
./composer.json
"require": {
...
"tss/automailer-bundle": "dev-master"
}
然后运行 composer.phar install
- 然后在
./app/AppKernel.php中启用该 bundle
public function registerBundles()
{
$bundles = [
...
new TSS\AutomailerBundle\TSSAutomailerBundle(),
];
}
- 在
./app/config.yml中更改 Swiftmailer spool 类型
swiftmailer:
...
spool: { type: automailer }
- 使用 Bundle 的实体更新您的数据库
app/console doctrine:schema:update --force
设置一个 cron 来执行队列
app/console automailer:spool:send
您还可以通过添加新的电子邮件来测试 spool
app/console automailer:test --email=info@trisoft.ro
Automailer 还有一个 Beanstalk 集成功能,该功能使用 pheanstalk 通过 automailer:spool:send 将作业发送到队列/tube。此功能在新电子邮件通过 mailer 发送时自动激活,如果已安装 pheanstalk,并且您在 ./app/config.yml 中添加了它
tss_automailer:
beanstalk: true
您还可以自定义实体管理器
tss_automailer:
manager: doctrine_mongodb.odm.document_manager
class: TSS\AutomailerBundle\DefaultDocument\Automailer
您可以通过简单地在 config.yml 中配置类并禁用相关功能来轻松自定义用于实体或文档的类
tss_automailer:
class: AppBundle\Entity\Automailer # or AppBundle\Document\Automailer, your specific path to your entity or document
disable_default_document: true # disables the default document so that you can use your own
disable_default_entity: true # disables the default entity so that you can use your own
为了自定义您希望与自己的功能一起使用的实体或文档,您可以通过扩展 TSS\Automailer\Model\Automailer 并在您的类中添加相关的 @ODM\Document() 或 @ORM\Entity() 注释来实现。
祝您玩得开心 :)