bencoderus / min-auth
This package serves as a token based client authentication system.
Requires
- php: ^7.2.5|^8.0
- illuminate/support: 5.8.*|^6.0|^7.0|^8.0
Requires (Dev)
- orchestra/testbench: ^4.0|^5.0|^6.0
- phpunit/phpunit: ^8.0|^9.0
This package is auto-updated.
Last update: 2025-03-29 00:48:36 UTC
README
Min Auth
Min Auth is a Laravel package that allows you to create and manage a client based authentication system on your Laravel web application.
Installation
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
Usage
Min Auth commands
Publish migration and configurations.
php artisan min-auth:install
Create a client
php artisan min-auth:create-client {name}
Using the middleware to protect your routes.
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'); }
Using the helpers
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);
Configuration
You can turn off IP Address verification via config/min-auth.php
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email bencoderus@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.