Laravel package that checks and creates WordPress password hashes

mikemclin/laravel-wp-password image

mikemclin/laravel-wp-password stats

Downloads
2.1M
Stars
82
Open Issues
0
Forks
16

View on GitHub →

Mikemclin Laravel-wp-password Readme


Laravel WP Password

This Laravel 4/5/6/7 package provides an easy way to create and check against WordPress password hashes. WordPress is not required.

Installation

Step 1: Composer

Begin by installing this package through Composer. Edit your project's composer.json file to require mikemclin/laravel-wp-password.

"require": {
"mikemclin/laravel-wp-password": "~2.0.1"
}

Next, update Composer from the Terminal:

composer update

Step 2: Register Laravel Service Provider

Once this operation completes, the final step is to add the service provider.

  • Laravel 5.x: Open config/app.php, and add a new item to the providers array
  • Laravel 4.x: Open app/config/app.php, and add a new item to the providers array
'MikeMcLin\WpPassword\WpPasswordProvider'

Usage

Add a use statement for the WpPassword facade

use MikeMcLin\WpPassword\Facades\WpPassword;

make() - Create Password Hash

Similar to the WordPress wp_hash_password() function

$hashed_password = WpPassword::make('plain-text-password');

check() - Check Password Hash

Similar to the WordPress wp_check_password() function

$password = 'plain-text-password';
$wp_hashed_password = '$P$B7TRc6vrwCfjgKLZLgmN.dmPo6msZR.';
 
if ( WpPassword::check($password, $wp_hashed_password) ) {
// Password success!
} else {
// Password failed :(
}

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: MikeMcLin\WpPassword\Contracts\WpPassword.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Mikemclin Laravel Wp Password Related Articles

Lucky Media logo

Lucky Media

Bespoke software solutions built for your business. We ♥ Laravel

Lucky Media
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Bacancy logo

Bacancy

Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $2500/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

Bacancy
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Larafast: Laravel SaaS Starter Kit logo

Larafast: Laravel SaaS Starter Kit

Larafast is a Laravel SaaS Starter Kit with ready-to-go features for Payments, Auth, Admin, Blog, SEO, and beautiful themes. Available with Vue and Livewire stacks.

Larafast: Laravel SaaS Starter Kit
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell