exolnet/laravel-emails-confirmation

Emails confirmation like Laravel native password resets.

v6.11.0 2024-10-03 18:56 UTC

README

Latest Release Total Downloads Build Status Software License

Emails confirmation like Laravel native password resets.

Beforehand

You should already have bootstrap a Laravel 5.5 project and deployed the auth scaffolding:

composer create-project --prefer-dist laravel/laravel your-project-name "5.5.*"
php artisan make:auth

Installation

Install exolnet/laravel-emails-confirmation for Laravel 5.5 using composer:

composer require "exolnet/laravel-emails-confirmation:5.5.*"

If you don't use package auto-discovery, add the service provider to the providers array in config/app.php:

Exolnet\Auth\Emails\EmailServiceProvider::class,

And the facade to the facades array in config/app.php:

'Email' => Exolnet\Support\Facades\Email::class,

Publishing

This modules provides a lot of publishable files. Some of which are overriding standard Laravel app files and others are overriding files (controllers and views) from the auth scaffolding.

If you just started a new project, you can simply force publish everything:

php artisan vendor:publish --provider="Exolnet\Auth\Emails\EmailServiceProvider" --force

If you have an already established project, you can either still force publish everything and look at the git diff to fix anything important that might have been overwritten, or you can copy the publishable files by hand.

Migrations

Run the migrations:

php artisan migrate

Routes

Invoke the Route::emails() macro in your routes file:

Route::emails();

Or define the following routes explicitly:

// Email Confirmation Routes...
Route::get('confirm', 'Auth\ResendConfirmationController@showLinkRequestForm')->name('email.resend');
Route::post('confirm', 'Auth\ResendConfirmationController@resendConfirmLinkEmail');
Route::get('confirm/{email}/{token}', 'Auth\ConfirmController@confirm')->name('email.confirm');

If you want to define explicitly the auth routes instead of using the Route::auth() macro, use this:

// Authentication Routes...
Route::get('login', 'Auth\LoginController@showLoginForm')->name('login');
Route::post('login', 'Auth\LoginController@login');
Route::post('logout', 'Auth\LoginController@logout')->name('logout');

// Registration Routes...
Route::get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
Route::post('register', 'Auth\RegisterController@register');

// Password Reset Routes...
Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
Route::post('password/reset', 'Auth\ResetPasswordController@reset');

Testing

To run the phpUnit tests, please use:

composer test

Contributing

Please see CONTRIBUTING and CODE OF CONDUCT for details.

Security

If you discover any security related issues, please email security@exolnet.com instead of using the issue tracker.

Credits

License

This code is licensed under the MIT license. Please see the license file for more information.