https://github.com/bencoderus/min-auth
Min auth is a package that allows you to create and manage a client based authentication system on your Laravel web application.
https://github.com/bencoderus/min-auth
Last synced: about 2 months ago
JSON representation
Min auth is a package that allows you to create and manage a client based authentication system on your Laravel web application.
- Host: GitHub
- URL: https://github.com/bencoderus/min-auth
- Owner: bencoderus
- License: mit
- Created: 2020-12-31T15:22:50.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-04-02T00:20:50.000Z (about 5 years ago)
- Last Synced: 2025-05-19T12:19:46.076Z (11 months ago)
- Language: PHP
- Homepage:
- Size: 266 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README

# Min Auth
[](https://travis-ci.org/bencoderus/min-auth)
[](//packagist.org/packages/bencoderus/minauth)
[](//packagist.org/packages/bencoderus/minaut)
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:
```bash
composer require bencoderus/min-auth
```
Publish migration and configurations.
```bash
php artisan min-auth:install
```
Run migrations
```bash
php artisan migrate
```
## Usage
#### Min Auth commands
Publish migration and configurations.
```php
php artisan min-auth:install
```
Create a client
```php
php artisan min-auth:create-client {name}
```
### Using the middleware to protect your routes.
In your route add `auth.client`
```php
Route::get('test', function(){
return "Hello world";
})->middleware('auth.client');
```
In your controller add `auth.client`
```php
public function __construct(){
$this->middleware('auth.client');
}
```
#### Using the helpers
Import Min Auth Helper
```php
use Bencoderus\MinAuth\MinAuth;
```
Create a client
```php
MinAuth::createClient($name);
// Optional
MinAuth::createClient($name, $ip, $isBlacklisted);
```
Find a client by API key
```php
MinAuth::findByApiKey($apiKey);
```
Blacklist a client
```php
MinAuth::blacklistClient($client);
```
Whitelist a client
```php
MinAuth::whitelistClient($client);
```
Refresh Client API key
```php
MinAuth::refreshApiKey($client);
```
Update client Ip address
```php
$ip = "127.0.0.8";
MinAuth::updateIpAddress($client, $ip);
```
#### Configuration
You can turn off IP Address verification via config/min-auth.php
### Testing
```bash
composer test
```
### Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
### Security
If you discover any security related issues, please email bencoderus@gmail.com instead of using the issue tracker.
## Credits
- [Benjamin Iduwe](https://github.com/bencoderus)
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.