phpmailer/apix-log-phpmailer
Composer 安装命令:
composer require phpmailer/apix-log-phpmailer
包简介
A PHPMailer logger for APIx Log
README 文档
README
An extension for the Apix/Log PSR-3 logger that sends log messages via email using PHPMailer.
The home repo is on github, and the composer package is on packagist.
Apix Log was written by Franck Cassedanne (@frqnck). This extension is by Marcus Bointon (@Synchro) and is published via the PHPmailer organisation under the BSD license (though note that PHPMailer itself uses the LGPL).
Installation
Install the logger via composer:
composer require phpmailer/apix-log-phpmailer
You require at least PHP 5.5.
Usage
Create an Apix PhpMailer Log instance, providing a pre-configured PHPMailer instance to the constructor. This instance will be used for all subsequent messages.
By default the logger sends an email for each individual log message received, which can be quite inefficient, so call $logger->setDeferred(true) to save up the log messages and send them all in one message on __destruct.
We suggest you enable exceptions in your PHPMailer instance (by passing true to the constructor) otherwise you may not be told about problems sending your log messages.
Example
use PHPMailer\PHPMailer\PHPMailer; // Create a PHPMailer instance with exceptions enabled $mailer = new PHPMailer(true); $mailer->addAddress('logs@example.com', 'Log Mailbox'); $mailer->setFrom('myapp@example.com', 'My App'); $mailer->isSMTP(); $mailer->SMTPAuth = true; $mailer->Host = 'tls://mail.example.com:587'; $mailer->Username = 'user'; $mailer->Password = 'pass'; $mailer->isHTML(false); $mailer->Subject = 'Error log'; $logger = new Apix\Logger\PhpMailer($mailer); $logger->setDeferred(true); $logger->info('Log me!'); $logger->error('Log me too!');
phpmailer/apix-log-phpmailer 适用场景与选型建议
phpmailer/apix-log-phpmailer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 256 次下载、GitHub Stars 达 10, 最近一次更新时间为 2015 年 09 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 phpmailer/apix-log-phpmailer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 phpmailer/apix-log-phpmailer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 256
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 22
- 依赖项目数: 0
- 推荐数: 2
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-09-11