mmockelyn/laravel-mail-viewer
Composer 安装命令:
composer require mmockelyn/laravel-mail-viewer
包简介
View all your mailables at a single place
README 文档
README
View all your mailables at a single place
The Design and content team members often need access to the emails your app will be sending out to the users. This is a fairly simple package that makes it possible and tries to minimize developer dependency. By using this package, you can have a dedicated route to view all your mailables at a single place. Having shareable URLs to view the mails makes the team co-ordination more smooth.
Installation
You can install this package via composer using this command:
composer require joggapp/laravel-mail-viewer
The package will automatically register itself.
You will have to add the mailables and configure the other settings using the package's config file in order to to use this package. Please read the comments/description for each config key thoroughly and set their values. You can publish the config file with:
php artisan vendor:publish --provider="JoggApp\MailViewer\MailViewerServiceProvider"
This will create the package's config file called mailviewer.php in the config directory. These are the contents of the published config file:
return [ /* |-------------------------------------------------------------------------- | Only the mailables registered here can be accessed using this package |-------------------------------------------------------------------------- | | You have to add the mailables including their dependencies | in the following array. When asked for a mailable, the | package will search it here for its definition. | | Add the mailable definition as shown below in the example. | The mailable class will be the key and the dependencies | of the mailable class will be defined in an array as well. | | The package will look for the equivalent factory if the | dependency is an eloquent model. So don't forget to | create those factories. If you want a specific state to | be used for your dependency you will have to pass an array | with 'class' and 'states' keys. The class key will have the | name of the dependency and states should contain an array of | factory states you want to apply to the factory, see the | MailWithDependencyStates example below. | | Please note that the factory times/count feature isn't | supported for the factories. | Eg: | What the package supports: factory(Order::class)->create(); | What the package doesn't support: factory(Order::class, 5)->create(); | | The package will try to resolve all other non-eloquent objects | using the Laravel's service container. | | Also, don't forget to import these classes at the top :) | | eg: | 'mailables' => [ | OrderShipped::class => [ | Order::class, | 'Personal thank you message', | ], | MailWithDependencyStates::class => [ | [ | 'class' => Order::class, | 'states' => ['state1', 'state2'] | ] | ], | MailWithNoDependency::class => [] | ] | */ 'mailables' => [], /* |-------------------------------------------------------------------------- | URL where you want to view the mails |-------------------------------------------------------------------------- | | This is the URL where you can view all the | mailables registered above. | */ 'url' => 'mails', /* |-------------------------------------------------------------------------- | The environments in which the url should be accessible |-------------------------------------------------------------------------- | | If you don't want to use this package in production env | at all, you can restrict that using this option | rather than by using a middleware. | */ 'allowed_environments' => ['local', 'staging', 'testing'], /* |-------------------------------------------------------------------------- | Middlewares that should be applied to the URL |-------------------------------------------------------------------------- | | The value should be an array of fully qualified | class names of the middleware classes. | | Eg: [Authenticate::class, CheckForMaintenanceMode::class] | Don't forget to import the classes at the top! | */ 'middlewares' => [], ];
How to use
-
After setting up the config values as described above, you can see the list of all mailables by visiting the
/mailsroute (considering the default url is 'mails' in the config file). You can modify it to whatever you want as per your needs. -
You can also restrict the environments the package should list the mailables in. By default, the
allowed_environmentsconfig is set to allow 3 environments:local,staging&testing. You can further secure it using themiddlewaresconfig. -
Default view:
| List of all mails | A particular mail rendered |
|---|---|
![]() |
![]() |
- This package supports the option of overriding the package views that Laravel provides. You can modify the view using these instructions from the Laravel docs, as per your needs.
Testing
You can run the tests with:
vendor/bin/phpunit
Changelog
Please see CHANGELOG for more information what has changed recently.
Security
If you discover any security related issues, please email harish@jogg.co instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
mmockelyn/laravel-mail-viewer 适用场景与选型建议
mmockelyn/laravel-mail-viewer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 32 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 05 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mmockelyn/laravel-mail-viewer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mmockelyn/laravel-mail-viewer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 32
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-05-30

