tapp/filament-maillog 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

tapp/filament-maillog

Composer 安装命令:

composer require tapp/filament-maillog

包简介

Filament plugin to view outgoing mail

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This plugin adds an event listener to log emails sent on mail_logs database table. It also adds a Filament resource to view the mail logs.

Version Compatibility

Filament Filament MailLog Documentation
4.x/5.x 2.x Current
3.x 1.x Check the docs

Installation

You can install the package via Composer:

composer require tapp/filament-maillog:"^2.0"

You can publish the config file with:

php artisan vendor:publish --tag="filament-maillog-config"

This is the contents of the published config file:

return [
    'amazon-ses' => [
        'configuration-set' => null,
    ],

    'resources' => [
        'MailLogResource' => \Tapp\FilamentMailLog\Resources\MailLogResource::class,
    ],

    'navigation' => [
        'maillog' => [
            'register' => true,
            'sort' => 1,
            'icon' => 'heroicon-o-rectangle-stack',
        ],
    ],

    'sort' => [
        'column' => 'created_at',
        'direction' => 'desc',
    ],

    'tenancy' => [
        'enabled' => env('FILAMENT_MAILLOG_TENANCY_ENABLED', false),
        'model' => null, // e.g. \App\Models\Team::class
        'relationship_name' => env('FILAMENT_MAILLOG_TENANCY_RELATIONSHIP_NAME', null),
        'column' => env('FILAMENT_MAILLOG_TENANCY_COLUMN', null),
        'nullable' => env('FILAMENT_MAILLOG_TENANCY_NULLABLE', true),
        'foreign_key' => [
            'on_delete' => env('FILAMENT_MAILLOG_TENANCY_ON_DELETE', 'cascade'),
            'on_update' => env('FILAMENT_MAILLOG_TENANCY_ON_UPDATE', 'cascade'),
        ],
        'auto_assign' => env('FILAMENT_MAILLOG_TENANCY_AUTO_ASSIGN', true),
    ],
];

You can publish and run the migrations with:

php artisan vendor:publish --tag="filament-maillog-migrations"
php artisan migrate

Warning: If you use multi-tenancy, configure tenancy before publishing and running migrations. See "Multi-Tenancy Support" below.

Optionally, you can publish the translations files with:

php artisan vendor:publish --tag="filament-maillog-translations"

Using the Resource

Add this plugin to a panel on plugins() method. E.g. in app/Providers/Filament/AdminPanelProvider.php:

use Tapp\FilamentMailLog\FilamentMailLogPlugin;
 
public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugins([
            FilamentMailLogPlugin::make(),
            //...
        ]);
}

Multi-Tenancy Support

Mail log entries can be scoped to a tenant (e.g. team or organization) when your Filament panel uses tenancy.

Setup

  1. Configure tenancy before migrations

    Publish the config and set in config/filament-maillog.php:

    'tenancy' => [
        'enabled' => true,
        'model' => \App\Models\Team::class,
        'relationship_name' => 'team',
        'column' => 'team_id',
        'nullable' => true,
        'auto_assign' => true,
    ],

    Or use env vars: FILAMENT_MAILLOG_TENANCY_ENABLED=true, FILAMENT_MAILLOG_TENANCY_COLUMN=team_id, etc.

  2. Publish and run migrations

    The mail_logs table will get the tenant foreign key when tenancy is enabled:

    php artisan vendor:publish --tag="filament-maillog-migrations"
    php artisan migrate
  3. Panel

    Ensure your panel uses the same tenant model, e.g. ->tenant(\App\Models\Team::class).

When tenancy is enabled, the resource is scoped to the current tenant and new mail logs are associated with the current tenant. The tenant column is nullable by default so emails sent before a tenant context exists, such as registration or verification messages, can still be logged.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

tapp/filament-maillog 适用场景与选型建议

tapp/filament-maillog 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 70.84k 次下载、GitHub Stars 达 30, 最近一次更新时间为 2024 年 04 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「maillog」 「tapp network」 「filament-maillog」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 tapp/filament-maillog 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 tapp/filament-maillog 我们能提供哪些服务?
定制开发 / 二次开发

基于 tapp/filament-maillog 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 30
  • Watchers: 6
  • Forks: 14
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-04-15