Laravel Mail Viewer is a package by Harish Toshniwal that enables you to view all the mailables in your Laravel application in 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 emails makes the team co-ordination more smooth.
I find this idea neat for developers too, because I am always looking through test emails to check out the email, and this package gives you an excellent way to reference all of them in one place.
The configuration is opt-in for the mailables that you want to appear, which means that any new emails you’d like to add you must explicitly define them. You can also constrain accessing mailables by the environment.
Here’s an example of what it looks like from the readme:
Here’s the configuration file at the time of writing:
<?php
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.
|
| Eg: [ new OrderShipped(factory(Order::class)->create()) ]
|
*/
'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' => [],
];
0 comments:
Post a Comment
Thanks