mostbyte / auth
Mostbyte authorization system from identity service
Installs: 378
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/mostbyte/auth
Requires
- php: ^8.4
- guzzlehttp/guzzle: ^7.8
- illuminate/contracts: ^11.0|^12.0
- illuminate/database: ^11.0|^12.0
- illuminate/support: ^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^9.0
- phpunit/phpunit: ^11.0
This package is auto-updated.
Last update: 2026-01-27 10:16:47 UTC
README
Authorization package for Laravel applications using Mostbyte Identity Service.
Requirements
| Dependency | Version |
|---|---|
| PHP | >= 8.4 |
| Laravel | 11.x, 12.x |
Version Compatibility
| Laravel Version | Package Version |
|---|---|
| < 10.x | 2.x |
| 11.x, 12.x | 3.x |
Installation
Install via Composer:
composer require mostbyte/auth
Or add manually to composer.json:
{
"require": {
"mostbyte/auth": "^3.0"
}
}
Then run:
composer update
Configuration
Publish the configuration file:
php artisan vendor:publish --provider="Mostbyte\Auth\AuthServiceProvider"
Environment Variables
| Variable | Description | Default |
|---|---|---|
IDENTITY_BASE_URL |
Identity service URL | https://auth.mostbyte.uz |
LOCAL_DEVELOPMENT |
Enable mock responses | true |
Warning Set
LOCAL_DEVELOPMENT=falsein production. Otherwise, all HTTP requests to the identity service will return fake responses.
Usage
Basic Middleware Usage
use Mostbyte\Auth\Middleware\IdentityAuth; Route::middleware(IdentityAuth::class)->get('/foo', function () { return 'bar'; });
With No-Domain Parameter
use Mostbyte\Auth\Middleware\IdentityAuth; Route::middleware(IdentityAuth::using('no-domain'))->get('/foo', function () { return 'bar'; });
Register as Alias
In bootstrap/app.php (Laravel 11+):
->withMiddleware(function (Middleware $middleware) { $middleware->alias([ 'identity' => \Mostbyte\Auth\Middleware\IdentityAuth::class, ]); })
Then use in routes:
Route::middleware('identity')->get('/foo', function () { return 'bar'; });
Accessing Authenticated User
// Get authenticated user $user = auth()->user(); // Access relationships $company = auth()->user()->company; $role = auth()->user()->role; // Get token $token = auth()->user()->getToken();
License
MIT