PHPackages                             javieraguerocl/wordpress-laravel-auth - 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. javieraguerocl/wordpress-laravel-auth

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

javieraguerocl/wordpress-laravel-auth
=====================================

A package to provide wordpress users in laravel authentication system.

v1.0.3(1y ago)06MITPHPPHP ^8

Since Oct 30Pushed 1y ago1 watchersCompare

[ Source](https://github.com/JavierAgueroCL/wordpress-laravel-auth)[ Packagist](https://packagist.org/packages/javieraguerocl/wordpress-laravel-auth)[ RSS](/packages/javieraguerocl-wordpress-laravel-auth/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (0)

**Laravel****wordpress-laravel-auth**5.2 to 5.5^1.05.6 to 11.x^2.0Installation
------------

[](#installation)

To install this package you will need

- At least Laravel 8.x ([for older versions of laravel](https://github.com/javieraguerocl/wordpress-laravel-auth/tree/v1))
- PHP 7.1 (or depending on your Laravel version)

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

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

```

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

```
"require": {
    "javieraguerocl/wordpress-auth-provider": "^2.0",
}

```

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,
],
```

Add following option along if using Laravel v7 (optional)

```
    // ...
    'url' => env('DATABASE_URL'),
    'options' => extension_loaded('pdo_mysql') ? array_filter([
        PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
    ]) : [],
```

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

```
