huserg/laravel-expiration-mailer

A simple package to implement a simple expiration mail notification for secrets or other reminders

0.1.9 2024-12-18 12:35 UTC

This package is auto-updated.

Last update: 2024-12-18 12:37:49 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This repo is a Laravel package to send an email to users when a secret or any value is about to expire.

Installation

You can install the package via composer:

composer require huserg/laravel-expiration-mailer

You can publish and run the migrations with:

php artisan vendor:publish --tag="laravel-expiration-mailer-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="laravel-expiration-mailer-config"

This is the contents of the published config file:

return [
# for the moment it's empty
];

Optionally, you can publish the views using

php artisan vendor:publish --tag="laravel-expiration-mailer-views"

Usage

Configure your route in routes/web.php

use Huserg\LaravelExpirationMailer\Http\Controllers\ExpirationMailerController;

Route::group(['prefix' => 'expirations'], function () {
    Route::get('', [ExpirationController::class, 'index'])->name('lem.expirations.index');
    Route::post('', [ExpirationController::class, 'store'])->name('lem.expirations.store');
    Route::post('{id}/force-send', [ExpirationController::class, 'forceSend'])->name('lem.expirations.force-send');
});

To override default 30 and 14 days schedule, add this to your app/Console/Kernel.php

protected function schedule(Schedule $schedule): void
{
    $schedule->command('expiration-mailer:send-email')->daily(); # or any other schedule
}

Testing

composer test

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

License

The MIT License (MIT). Please see License File for more information.