Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Drupal7 Password Hasher

Drupal7 Password Hasher Laravel Package

selfsimilar/drupal7_password_hasher

PHP package for verifying and generating Drupal 7-compatible password hashes. Useful for migrating users to Laravel or other apps while preserving existing credentials, with support for Drupal’s phpass-based hashing format and validation against stored hashes.

View on GitHub
Deep Wiki
Context7

Similar to https://github.com/hautelook/phpass, this is a PSR-4 compliant wrapper around the Drupal 7 password hashing code. For use in non-Drupal projects that need to import Drupal 7 user accounts.

Frequently asked questions about Drupal7 Password Hasher
How do I install this package for Laravel user migration?
Run `composer require selfsimilar/drupal7_password_hasher` and wrap the package in a Laravel-compatible class (e.g., implementing `HashInterface`). No service provider is included, so manual binding is required in your `AppServiceProvider`. Test with a sample Drupal 7 hash first to confirm compatibility.
Can this package handle password resets for migrated Drupal 7 users?
No, this package only handles hashing/verification. For password resets, you’ll need to integrate it with Laravel’s `Password::reset()` or manually validate tokens against the Drupal 7 hash format. Ensure your reset flow checks the hash prefix (e.g., `$2y$` for phpass) before processing.
What Laravel versions does this package support?
The package works with Laravel 5.5+ and PHP 7.4+, as it relies on Drupal 7’s minimum requirements. For older Laravel versions (e.g., 5.x), you may need to polyfill `HashInterface` or use a custom guard. Test thoroughly with your target Laravel version.
Is this package secure for new user registrations in Laravel?
No. Drupal 7’s hashing (SHA-512 + salt) is outdated compared to Laravel’s default (Bcrypt/Argon2). Use this **only** for migrating existing Drupal 7 users. For new users, always use Laravel’s `Hash::make()` with a modern algorithm.
How do I integrate this with Laravel’s authentication system?
Create a custom guard or extend Laravel’s `Hash` facade to delegate Drupal 7 hashes to this package. Override `retrieveByCredentials()` in your `AuthServiceProvider` to handle legacy hashes. Example: Check if the stored hash starts with `$2y$` (Drupal 7 phpass format) and route it to the Drupal hasher.
What if my Drupal 7 site uses a custom `password_count_log2` value?
Pass the value to the `Hasher` constructor (default is 15). Retrieve it from Drupal 7 via `drush variable-get password_count_log2` or check your `settings.php`. Mismatched iteration counts will cause verification failures, even for correct passwords.
Are there alternatives to this package for Drupal 7 migrations?
Yes. Consider [`hautelook/phpass`](https://github.com/hautelook/phpass), which is more actively maintained and supports Drupal 7/8 hashes. For Laravel, you could also manually implement phpass logic or use Laravel’s `Hash` facade with a custom driver. Evaluate based on your need for Drupal 7 *specific* compatibility.
How do I test if this package works with my existing Drupal 7 hashes?
Export a few Drupal 7 user passwords (e.g., from `users` table) and verify them using the package’s `CheckPassword()` method. Compare results against Drupal 7’s native `user_pass()` function or a test environment. Example: `DrupalHasher::CheckPassword('test', '$2a$08$hashedString')`.
Will this package work with Laravel’s Eloquent or database migrations?
No direct integration exists. Use it in a console command or seeder to rehash imported users. Example: `User::where('imported_from', 'drupal7')->each(fn($user) => $user->password = DrupalHasher::hash($user->plain_password));`. Avoid storing Drupal 7 hashes long-term; migrate to Laravel’s format ASAP.
What happens if I mix Drupal 7 and Laravel hashes in the same database?
Avoid this if possible. Use a column like `password_format` (e.g., `drupal7` or `laravel`) to distinguish hashes. In your auth logic, route verification to the correct hasher based on this flag. Example: `if (str_starts_with($hash, '$2y$')) { use DrupalHasher; } else { use Hash::check(); }`
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor