PHPackages                             aiyuchen/wordpress-auth-provider - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. aiyuchen/wordpress-auth-provider

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

aiyuchen/wordpress-auth-provider
================================

A package to provide wordpress users in laravel authentication system.

v2.1.3(3y ago)026MITPHPPHP ^7.1|^8.0

Since Oct 10Pushed 3y agoCompare

[ Source](https://github.com/cgfeel/wordpress-auth-driver-laravel)[ Packagist](https://packagist.org/packages/aiyuchen/wordpress-auth-provider)[ RSS](/packages/aiyuchen-wordpress-auth-provider/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (12)Used By (0)

Wordpress Auth Driver for Laravel
=================================

[](#wordpress-auth-driver-for-laravel)

[![Latest Stable Version](https://camo.githubusercontent.com/c2f70242efa2810b21ee0925b051c5dcf37f1ae9fabfb9dfb2a9f5851675bfd3/68747470733a2f2f706f7365722e707567782e6f72672f616873616e6b68617472692f776f726470726573732d617574682d70726f76696465722f762f737461626c65)](https://packagist.org/packages/ahsankhatri/wordpress-auth-provider) [![Total Downloads](https://camo.githubusercontent.com/284ea2a0c6acacd64b2953907f4ae4854d29677aa0388694acee249c70ba6703/68747470733a2f2f706f7365722e707567782e6f72672f616873616e6b68617472692f776f726470726573732d617574682d70726f76696465722f646f776e6c6f616473)](https://packagist.org/packages/ahsankhatri/wordpress-auth-provider) [![Build Status](https://camo.githubusercontent.com/26f862042a206d7180ca8631f8ce061ca64598da1df70284d1f051a74b57b98f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616873616e6b68617472692f776f726470726573732d617574682d6472697665722d6c61726176656c2f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/ahsankhatri/wordpress-auth-driver-laravel/build-status/master) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/5b5b72cd840b40b181b8964d3c69d517defca3f26e3803ac01238774d30a5665/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616873616e6b68617472692f776f726470726573732d617574682d6472697665722d6c61726176656c2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/ahsankhatri/wordpress-auth-driver-laravel/?branch=master) [![Code Intelligence Status](https://camo.githubusercontent.com/df6e39c589a9f144cbc1379f2d826dc26928dadd78c76cbae85e4f7eaf0df3c4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616873616e6b68617472692f776f726470726573732d617574682d6472697665722d6c61726176656c2f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d6173746572)](https://scrutinizer-ci.com/code-intelligence) [![License](https://camo.githubusercontent.com/51e1718d746f9126863b71aca606b0036ad0ce62230b4eb89715c3e15a29d688/68747470733a2f2f706f7365722e707567782e6f72672f616873616e6b68617472692f776f726470726573732d617574682d70726f76696465722f6c6963656e7365)](https://packagist.org/packages/ahsankhatri/wordpress-auth-provider)

**Laravel****wordpress-auth-driver-laravel**5.2 to 5.5^1.05.6 to 5.8^2.0^6.0\*Installation
------------

[](#installation)

To install this package you will need Laravel 5.\*

- Laravel ^5.6|^6.0|^7.0|^8.0|^9.0 ([for older versions of laravel](https://github.com/ahsankhatri/wordpress-auth-driver-laravel/tree/v1))
- PHP 7.1

Laravel 6.\*

- Laravel 6.1
- PHP &gt;= 7.2

The best way to install this package is with the help of composer. Run

```
composer require aiyuchen/wordpress-auth-provider

```

or install it by adding it to `composer.json` then run `composer update`

```
"require": {
    "aiyuchen/wordpress-auth-provider": "*",
}

```

Setup
-----

[](#setup)

Once you have installed this package from the [composer](https://packagist.org/packages/ahsankhatri/wordpress-auth-provider), make sure to follow the below steps to configure.

To register authentication guard.

##### config/auth.php

[](#configauthphp)

```
'guards' => [
    ...,
    'wordpress' => [
        'driver' => 'session',
        'provider' => 'wordpress',
    ],
```

```
'providers' => [
    ...,
    'wordpress' => [
        'driver' => 'eloquent.wordpress',
        'model' => MrShan0\WordpressAuth\Models\WordpressUser::class,
    ],
```

```
'passwords' => [
    ...,
    'wordpress' => [
        'provider' => 'wordpress',
        'table' => 'password_resets',
        'expire' => 60,
    ],
```

#### Publish config file (optional)

[](#publish-config-file-optional)

```
php artisan vendor:publish --provider="MrShan0\WordpressAuth\WordpressAuthServiceProvider"
```

It will publish config file (`config/wordpress-auth.php`) where you can define your own connection type e.g `wp-mysql`. Make sure to fill `prefix` in `config/database.php` for `wp_` prefix in your tables if you're using prefix in wordpress tabels.

For example:

```
'wp-mysql' => [
    'driver' => 'mysql',
    'host' => env('WP_DB_HOST', '127.0.0.1'),
    'port' => env('WP_DB_PORT', '3306'),
    'database' => env('WP_DB_DATABASE', 'forge'),
    'username' => env('WP_DB_USERNAME', 'forge'),
    'password' => env('WP_DB_PASSWORD', ''),
    'unix_socket' => env('WP_DB_SOCKET', ''),
    'charset' => 'utf8mb4',
    'collation' => 'utf8mb4_unicode_ci',
    'prefix' => 'wp_',
    'prefix_indexes' => true,
    'strict' => true,
    'engine' => null,
],
```

Configuration
-------------

[](#configuration)

`password_resets` table (from Laravel default auth mechanism) is required to hold reset password token. If you do not have `password_resets` table then use this migration instead

```
