PHP code example of wp-kit / auth

1. Go to this page and download the library: Download wp-kit/auth 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/ */

    

wp-kit / auth example snippets


composer 

//inside theme/resources/config/providers.config.php

return [
    //
    WPKit\Auth\AuthServiceProvider::class
    //
];

// inside themosis-theme/resources/providers/RoutingService.php

namespace Theme\Providers;

use Themosis\Facades\Route;
use Themosis\Foundation\ServiceProvider;

class RoutingService extends ServiceProvider
{
    /**
     * Define theme routes namespace.
     */
    public function register()
    {
        Route::group([
	        'middleware' => [
			'start_session',
			'auth',
	        	//'auth.basic',
			//'auth.wp_login',
			//'auth.token'
		],
            	'namespace' => 'Theme\Controllers'
        ], function () {
        	

// inside themosis-theme/resources/routes.php

Route::get('home', function(Input $request)
{
    return view('welcome');
    
})->middleware('auth.wp_login');

namespace Theme\Controllers;

use Themosis\Route\BaseController;
use WPKit\Auth\Traits\AuthenticatesUsers;
use WPKit\Auth\Traits\ValidatesRequests;

class LoginController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Login Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles authenticating users for the application and
    | redirecting them to your home screen. The controller uses a trait
    | to conveniently provide its functionality to your applications.
    |
    */
    use AuthenticatesUsers, ValidatesRequests;
    
    /**
     * Where to redirect users after login.
     *
     * @var string
     */
    protected $redirectTo = '/';
    
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest')->except('logout');
    }
    
}

// an example in routes.php

Route::get('account', 'Example@showLoginForm');
Route::post('account', 'Example@login');
Route::get('logout', 'Example@logout');

<-- Inside resources/view/auth/login.php -->
 foreach( $errors as $field => $error ) :