Download the PHP package xammie/mailbook without Composer
On this page you can find all versions of the php package xammie/mailbook. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download xammie/mailbook
More information about xammie/mailbook
Files in xammie/mailbook
Package mailbook
Short Description Laravel Mail Explorer
License MIT
Homepage https://github.com/xammie/mailbook
Informations about the package mailbook
Mailbook
Mailbook is a Laravel package that lets you easily inspect your mails without having to actually trigger it in your application.
Installation
You can install the package via composer:
Next install mailbook into your application
Usage
The mailbook:install
command will create a route file named routes/mailbook.php
. In this file you can register your
emails.
Next head over to /mailbook
to preview the mailables.
Registering mails
You can both register mailables that live in App\Mails
and email notifications in App\Notifications
.
You can also use dependency injection in the closure.
Sending to a user
A notification will most of the time need a user (also called notifiable
in the notification class).
You can set the desired user with the ::to()
method.
If you don't need a user you can also pass an e-mail address.
Grouping multiple mails
You can group multiple mails under the same category. This can be done using the category()
and group()
methods.
To avoid having to pass the same to()
to every mailable that needs it you can also use the group()
method. This will
use the notifiable to every mailable inside the group.
It is also possible to chain both category()
and to()
to the same group.
Variants
When creating mails you might have a couple of different scenario's that you want to test for one mail, you can use variants to solve this.
Localization
When your application supports multiple languages you need to easily preview your mails in these languages. To enable
this feature you have to add the following code to the mailbook.php
config file.
This will display a dropdown in mailbook which you can use to switch to a different language.
Using the database
Most of the time your mailables will need database models. Sometimes you will even preform queries when rendering these mailables. Mailbook can automatically rollback database changes after rendering. You can enable it in the config with.
You can now safely use factories and other queries when registering your mailables.
Database rollback is disabled by default.
Sending Mails
Testing your mails outside the browser is important if you want to make sure that everything is displayed correctly. You can use Mailbook to send mails to an email address of your choice using your default mail driver. This will show a button in the top-right corner which when pressed will send the currently selected email to the specified address. You can enable this in the config:
Customization
You can publish the config file with:
Optionally, you can publish the views using
Testing
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
- Max Hoogenbosch
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of mailbook with dependencies
spatie/laravel-package-tools Version ^1.9.2
illuminate/contracts Version ^9.0 || ^10.0 || ^11.0