Skip to content

Commit

Permalink
doc: Add an example of Mailer usage
Browse files Browse the repository at this point in the history
  • Loading branch information
marienfressinaud committed Nov 29, 2024
1 parent dc1a6af commit 72a27d1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,25 @@
*
* This class can be inherited in order to specialize it into smaller Mailers.
*
* ```php
* class UserMailer extends \Minz\Mailer
* {
* public function sendResetPasswordEmail($user_id): bool
* {
* $user = models\User::find($user_id);
*
* $subject = 'Reset your password';
* $this->setBody(
* 'path/to/view.phtml',
* 'path/to/view.txt',
* ['user => $user],
* );
*
* return $this->send($user->email, $subject);
* }
* }
* ```
*
* @phpstan-import-type ViewVariables from Output\View
*
* @phpstan-import-type ViewPointer from Output\View
Expand Down

0 comments on commit 72a27d1

Please sign in to comment.