定制 ahmed-j-alsarem/laravel-bcrypt-password 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ahmed-j-alsarem/laravel-bcrypt-password

最新稳定版本:v2.0.4

Composer 安装命令:

composer require ahmed-j-alsarem/laravel-bcrypt-password

包简介

A Laravel package for bcrypt password hashing functionality

README 文档

README

A Laravel package for bcrypt password hashing functionality with WordPress password compatibility.

Installation

You can install the package via composer:

composer require ahmed-j-alsarem/laravel-bcrypt-password

Configuration

Publish the configuration file:

php artisan vendor:publish --provider="AhmedJAlsarem\LaravelBcryptPassword\BcryptPasswordServiceProvider"

Usage

use AhmedJAlsarem\LaravelBcryptPassword\PasswordHasher;

// Via dependency injection
public function __construct(PasswordHasher $hasher)
{
    $this->hasher = $hasher;
}

// Hash a password
$hash = $this->hasher->hash('password123');

// Verify a password (supports both Laravel and WordPress hashes)
$isValid = $this->hasher->verify('password123', $hash);

// WordPress Password Compatibility
// Example with WordPress password hash
$wp_hash = '$wp$2y$10$y6/UfA/WhvVLZK6RxBSJE./L6YpJN8ChGg15a0Pqry/bTGsDuMR1q';
$isValid = $this->hasher->verify('Na101918!', $wp_hash);

// Supports multiple WordPress hash formats:
// 1. WordPress bcrypt with $wp$ prefix
// 2. WordPress phpass with $P$ prefix
// 3. phpBB3 with $H$ prefix
// 4. Standard bcrypt with $2y$ prefix

// Check if password needs rehash
$needsRehash = $this->hasher->needsRehash($hash);

Configuration

You can configure the bcrypt cost and WordPress compatibility options in your .env file:

BCRYPT_COST=12
WP_ITERATION_COUNT_LOG2=8
WP_PORTABLE_PASSWORDS=true

Or in the configuration file config/bcrypt-password.php.

Testing

composer test

License

The MIT License (MIT)

统计信息

  • 总下载量: 254
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-23