PHP code example of bencoderus / min-auth

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

    

bencoderus / min-auth example snippets


php artisan min-auth:install

php artisan min-auth:create-client {name}

Route::get('test', function(){
    return "Hello world";
})->middleware('auth.client');

public function __construct(){
    $this->middleware('auth.client');
}

use Bencoderus\MinAuth\MinAuth;


MinAuth::createClient($name);
// Optional
MinAuth::createClient($name, $ip, $isBlacklisted);

MinAuth::findByApiKey($apiKey);

MinAuth::blacklistClient($client);

MinAuth::whitelistClient($client);

MinAuth::refreshApiKey($client);

$ip = "127.0.0.8";
MinAuth::updateIpAddress($client, $ip);
bash
php artisan min-auth:install
bash
php artisan migrate