tormjens/wp-queue-mail
Composer 安装命令:
composer require tormjens/wp-queue-mail
包简介
Candidate profiles for OSM Aviation.
关键字:
README 文档
README
A plugin to queue WordPress emails. When sending out emails in bulk the action of sending each of them is both time and resource consuming. That's where queues come in. When you add an e-mail to a queue instead of sending it, it is a matter of adding a row to the database, instead of connecting to the server, sending the contents and so on.
Simply enable the plugin and it will automatically hook in to the wp_mail function and start queueing emails.
The queue part was taken from the (Mailchimp for WooCommerce plugin)[https://github.com/mailchimp/mc-woocommerce], but was originally written by (A5hleyRich)[https://github.com/A5hleyRich/wp-background-processing]
Getting started
The tables needed for the queue to work can be set up using the following WP CLI command in the root of your project.
$ wp queue create-tables
The queue
The queue can be processed in two ways.
Via a WP CLI queue listener
This is my favorite as it runs on the CLI and thus is not affected by the memory and timeout limit of PHP.
Start the queue listener by navigation to the root of your project and type:
$ wp queue listen
To make sure the queue listener is always running you could use something like (Supervisor)[http://supervisord.org/].
Via WP Cron
This works for most websites running WordPress. The queue is simply added to the WP Cron schedule and executed according to it.
Using it for other things than mails
The queue is not specifically bound to sending emails. You can create your own jobs and dispatch them via the features of this plugin.
The job
A job must extend the WP_Job class and contain a handle method. You can use a constructor to give the job the data you need processed.
<?php class Publish_Podcast extends WP_Job { protected $name; protected $location; public function __construct( $name, $location ) { $this->name = $name; $this->location = $location; } public function handle() { // process the podcast here } }
The handle method is what will be fired by the queue.
When you are ready to dispatch a job, you can use the convenient wp_queue helper function.
<?php wp_queue(new Publish_Podcast('Scooby Doo And His Friends', 'iTunes'));
The next time the queue is processed the job will be a part of it. Neat!
tormjens/wp-queue-mail 适用场景与选型建议
tormjens/wp-queue-mail 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 56 次下载、GitHub Stars 达 8, 最近一次更新时间为 2017 年 11 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「wordpress」 「wp」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 tormjens/wp-queue-mail 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tormjens/wp-queue-mail 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 tormjens/wp-queue-mail 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Must-use plugin integrating WordPress with the Upsun platform: environment awareness, router-cache friendliness, safe preview clones, deploy migrations, Site Health checks, and a wp upsun CLI command.
Inertia.js server-side adapter for PHP. Handles full visits, Inertia XHR visits, asset-version 409 handshakes and partial reloads. Framework-agnostic, with transparent WordPress integration.
Adds Cache-Tag HTTP response headers for singular WordPress content and purges Cloudflare by tag when content changes.
AI Chatbot & Helpdesk Agent for WooCommerce. Connects your store to Egentify for AI-powered chat, order tracking, email, and ticketing.
MIDDAG's reference architecture for a WordPress plugin — composes the OSS framework/wordpress/ui libraries end to end.
Assets helper package for the Hybrid Core framework.
统计信息
- 总下载量: 56
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-11-13