定制 programster/email-logger 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

programster/email-logger

最新稳定版本:1.0.0

Composer 安装命令:

composer require programster/email-logger

包简介

A logger that logs via email and is compatible with PSR-3

README 文档

README

A PSR-3 logger for PHP that sends logs via email.

Installation

composer require programster/email-logger

Example Usage

# Create an emailer, in this case using PHPMailer.
# Any emailer that implements the EmailerInterface will work
$emailer = new Programster\Emailers\PhpMailerEmailer(
    "smtp.gmail.com",
    "someemail@gmail.com",
    "app-specific-password-goes-here",
    SecurityProtocol::TLS,
    "someemail@gmail.com",
    "Senders Name",
    587,
    "noreply@someemail.com",
    "noreply"
);

# Create the email logger
$logger = new EmailLogger(
    $emailer,
    "my-service-name-here",
    new EmailSubscriber("Jenn", "jenn@somdomain.com"),
    new EmailSubscriber("Roy", "roy@anotherdomain.com"),
);

# Create some useful context for the log that might help debugging/resolving what went wrong...
$context = [
    'some' => 'details'
];

# Send the log (email)
$logger->critical("There was a critical error!", $context);

Testing

When developing this package, please be sure to test, even if it's very basic. For now, one can test by removing the .example extension from the settings.php.example file, and filling it in. Then execute the main.php script to send emails to the subscribers specified in your settings.

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-04-25