PHP code example of calderawp / laravel-wp-user

1. Go to this page and download the library: Download calderawp/laravel-wp-user library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

calderawp / laravel-wp-user example snippets


Route::post('/wp-login', function( \calderawp\WPUser\JWTAuthenticator $authenticator, \Illuminate\Http\Request $request ){
	if( $request->has( 'username' ) && $request->has( 'password' ) ){
		if( $authenticator->login( $request->input( 'username'), $request->input( 'password' ) ) ){
			$user = \calderawp\WPUser\Model\Model::fromAuth( $authenticator );
		}

		//return an error;
	}
});