maxwellimpact / laravel-password-reset
Laravel Password Reset Extension to enable Injected Repositories
Installs: 5 917
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 4
Open Issues: 1
Requires
- php: ^7.0
- laravel/framework: ~5.2.0|~5.3.0|~5.4.0|~5.5.0|~5.6.0|~5.7.0|~5.8.0
Requires (Dev)
- orchestra/testbench: ~3.5.0|~3.6.0|~3.7.0
- phpunit/phpunit: ^6.2|^7.0
This package is auto-updated.
Last update: 2025-04-26 05:24:15 UTC
README
Extends the default password reset for Laravel to enable custom Token repositories. It also adds an in memory Token Repository for testing.
Setup
Install
composer require maxwellimpact/laravel-password-reset
Add the Service Provider
In config/app.php
replace Illuminate\Auth\Passwords\PasswordResetServiceProvider
with Maxwellimpact\PasswordReset\PasswordResetServiceProvider
Note: If you are using Laravel 5.5 and up and have Package Discovery on, then just remove the original Laravel provider and it should work fine.
Register Your Custom Repository
Register your custom repository creator in one of your Service Providers boot method. The in_memory
repository is already registered by default.
public function boot() { Password::repository('in_memory', function($app, $config) { return new InMemoryTokenRepository($config['expire']); }); }
Configure the Repository
Add your settings in auth.php
. The repository
option is required for custom token repositories to be created, otherwise it defaults to the DatabaseTokenRepository
that Laravel is hardcoded to. All config options will be passed in to your registered creator.
... 'passwords' => [ 'users' => [ 'provider' => 'users', 'repository' => 'in_memory', 'expire' => 10, ], ]