Min Auth is a Laravel package that allows you to create and manage a client based authentication system on your Laravel web application.
This package requires PHP >= 7.2 and above. (Laravel 8 and PHP 8 support are available).
You can install the package via composer:
composer require bencoderus/min-auth
Publish migration and configurations.
php artisan min-auth:install
Run migrations
php artisan migrate
Publish migration and configurations.
php artisan min-auth:install
Create a client
php artisan min-auth:create-client {name}
In your route add auth.client
Route::get('test', function(){
return "Hello world";
})->middleware('auth.client');
In your controller add auth.client
public function __construct(){
$this->middleware('auth.client');
}
Import Min Auth Helper
use Bencoderus\MinAuth\MinAuth;
Create a client
MinAuth::createClient($name);
// Optional
MinAuth::createClient($name, $ip, $isBlacklisted);
Find a client by API key
MinAuth::findByApiKey($apiKey);
Blacklist a client
MinAuth::blacklistClient($client);
Whitelist a client
MinAuth::whitelistClient($client);
Refresh Client API key
MinAuth::refreshApiKey($client);
Update client Ip address
$ip = "127.0.0.8";
MinAuth::updateIpAddress($client, $ip);
You can turn off IP Address verification via config/min-auth.php
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email bencoderus@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.