LaravelPackages.net
Acme Inc.
Toggle sidebar
bencoderus/min-auth

This package serves as a token based client authentication system.

16
7
1.0
About bencoderus/min-auth

bencoderus/min-auth is a Laravel package for this package serves as a token based client authentication system.. It currently has 7 GitHub stars and 16 downloads on Packagist (latest version 1.0). Install it with composer require bencoderus/min-auth. Discover more Laravel packages by bencoderus or browse all Laravel packages to compare alternatives.

Last updated

Laravel webhook preview

Min Auth

Build Status Latest Stable Version License

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 [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Comments