mostbyte / auth
Mostbyte authorization system from identity service
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
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-master
- 4.x-dev
- 4.3.2
- 4.3.1
- 4.3.0
- 4.2.1
- 4.2.0
- 4.1.0
- 4.0.0
- 3.x-dev
- 3.3.2
- 3.3.1
- 3.3.0
- 3.2.7
- 3.2.6
- 3.2.5
- 3.2.4
- 3.2.3
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.3
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.1
- 3.0
- 2.0
- 1.2.0
- 1.1.8
- 1.1.7
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.10
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-fix/token-cache-key-4x
- dev-fix/token-cache-key
- dev-fix/token-cache-key-3x
This package is auto-updated.
Last update: 2026-10-21 10:57:21 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 | false |
Warning
LOCAL_DEVELOPMENT=truemakes every request to the identity service return a fake success response, so any token is accepted as a valid superUser. It is an authorization bypass, not a convenience flag. The default isfalseso that a service which never sets the variable is secure; opt in explicitly in your local.envonly.Changed in 5.0.0 — previously the default was
true, which meant a deploy that forgot to setLOCAL_DEVELOPMENT=falseran with authorization disabled. If you are upgrading and relied on the old default for local work, addLOCAL_DEVELOPMENT=trueto your local.env.
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