Download the PHP package selfsimilar/laravel-d7-password without Composer
On this page you can find all versions of the php package selfsimilar/laravel-d7-password. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download selfsimilar/laravel-d7-password
More information about selfsimilar/laravel-d7-password
Files in selfsimilar/laravel-d7-password
Package laravel-d7-password
Short Description Laravel package that checks and creates Drupal 7 password hashes
License MIT
Homepage https://github.com/selfsimilar/laravel-d7-password
Informations about the package laravel-d7-password
Laravel Drupal 7 Password
This Laravel 8 package provides an easy way to create and check against Drupal 7 password hashes. Drupal is not required.
Installation
Step 1: Composer
Begin by installing this package through Composer. Edit your project's
composer.json
file to require selfsimilar/laravel-d7-password
.
Next, update Composer from the Terminal:
Step 2: Register Laravel Service Provider
Once this operation completes, the final step is to register the service provider.
- Laravel 5-8.x: Open
config/app.php
, and add a new item to the providers array
Usage
Add a use statement for the D7Password facade
make()
- Create Password Hash
Similar to the Drupal
user_hash_password()
function
check()
- Check Password Hash
Similar to the Drupal
user_check_password()
function
Dependency Injection
I used a facade above to simplify the documentation. If you'd prefer not to use
the facade, you can inject the following interface: Selfsimilar\D7Password\Contracts\D7Password
.
Recommendations
While you could in principle register and use the D7PasswordHasher as the default hasher and leave the passwords alone, you can also update the passwords to the better and more secure Laravel default Bcrypt algorithm. When authenticating, first check using the default hasher, and if that fails, check again with the Drupal 7 Hasher. If that succeeds, simply update the password hash for future logins.
As an example, assuming you have a fresh Laravel 8 application using Fortify (or Jetstream which uses Fortify), make the following changes to app/Providers/FortifyServiceProvider.php
.
Import the following:
Add this to the boot()
method:
All versions of laravel-d7-password with dependencies
php Version >=5.3.0
illuminate/support Version >=4.0.0