antriver / laravel-simple-message-trait
Package info
github.com/antriver/laravel-simple-message-trait
pkg:composer/antriver/laravel-simple-message-trait
Requires
- laravel/framework: >=5.3.0
This package is auto-updated.
Last update: 2026-03-07 05:37:52 UTC
README
Laravel provides a SimpleMessage class for mail representation of notifications (https://github.com/laravel/framework/blob/5.8/src/Illuminate/Notifications/Messages/SimpleMessage.php) but sometimes you want to use this nice interface on a regular Mailable instance. This package is simply a copy and paste of the SimpleMessage class but as a trait instead of a class.
Install
composer require antriver/laravel-simple-message-trait
Example
<?php namespace MySite\Mail; use Antriver\LaravelSimpleMessageTrait\SimpleMessageTrait; use Illuminate\Mail\Mailable; abstract class MyCoolMailable extends Mailable { use SimpleMessageTrait; // ... }
Notes
The with($line) method has been removed from the trait because that conflicts with the with($key, $value = null) method on Mailable. Instead you can use line($line) which does the same thing.