laravel-app-context maintained by ronu
Description
Multi-channel application context management for Laravel with JWT and API Key authentication
Author
Last update
2026/02/10 21:09
(dev-main)
License
Downloads
69
Tags
Last update
2026/02/10 21:09
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/02/10 21:04
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/02/06 14:37
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/02/06 13:18
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/02/06 13:15
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/02/06 12:53
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/02/06 12:51
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/02/05 00:36
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/02/04 12:22
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/02/04 11:49
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/02/04 01:20
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/02/03 01:28
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/02/02 23:34
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/02/02 23:15
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/31 00:57
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/31 00:53
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/31 00:38
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/29 11:10
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/26 14:01
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/26 13:35
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/26 12:17
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/26 12:02
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/25 14:27
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/23 17:13
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/23 17:12
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/23 14:10
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/23 14:09
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/23 13:44
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/23 13:33
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/23 13:08
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/23 12:38
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/22 18:02
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/22 17:54
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/22 17:26
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/22 16:12
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/22 13:29
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/22 12:56
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/22 12:35
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/22 12:18
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/21 23:34
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/21 18:14
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/21 17:59
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/21 17:45
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Last update
2026/01/21 14:05
License
Require
- php ^8.2
- illuminate/support ^11.0|^12.0
- illuminate/http ^11.0|^12.0
- illuminate/routing ^11.0|^12.0
- illuminate/cache ^11.0|^12.0
- php-open-source-saver/jwt-auth ^2.0
Laravel App Context
Multi-channel application context management for Laravel (JWT + API key auth) with channel detection, context-aware rate limiting, and audit logging.
- Documentation: documentation/index.md
Requirements
- PHP 8.2+
- Laravel 11.x or 12.x
php-open-source-saver/jwt-auth2.x
Installation
composer require ronu/laravel-app-context
Publish config:
php artisan vendor:publish --tag=app-context-config
Quickstart
- Configure a channel in
config/app-context.php:
'channels' => [
'site' => [
'subdomains' => ['www', null],
'path_prefixes' => ['/site'],
'auth_mode' => 'jwt_or_anonymous',
'jwt_audience' => 'site',
'allowed_scopes' => ['site:*', 'catalog:browse'],
'public_scopes' => ['catalog:browse'],
'rate_limit_profile' => 'site',
'tenant_mode' => 'single',
'features' => [
'allow_anonymous' => true,
],
],
],
- Apply the middleware group:
use Illuminate\Support\Facades\Route;
use Ronu\AppContext\Facades\AppContext;
Route::middleware(['app-context'])->group(function () {
Route::get('/site/profile', function () {
return response()->json([
'channel' => AppContext::getAppId(),
'auth_mode' => AppContext::getAuthMode(),
'scopes' => AppContext::getScopes(),
]);
});
});
Configuration
- Config lives in
config/app-context.php(publish tag:app-context-config). - Environment variable reference: documentation/02-configuration/01-env-vars.md
- Full config reference: documentation/02-configuration/00-configuration-reference.md
Common scenarios
1) Mobile app with JWT scopes
Route::middleware(['app-context', 'app.requires:mobile:orders:read'])->group(function () {
Route::get('/mobile/orders', fn () => ['ok' => true]);
});
2) Partner API with API keys
Route::middleware(['app-context', 'app.requires:partner:orders:read'])->group(function () {
Route::get('/partner/orders', fn () => ['ok' => true]);
});
3) Admin dashboard (subdomain detection)
Route::middleware(['app-context', 'app.scope:admin:*'])->group(function () {
Route::get('/api/admin/metrics', fn () => ['ok' => true]);
});
More scenarios: documentation/03-usage/02-scenarios.md
Edge scenarios
Common edge cases include config caching, queue workers, burst traffic, tenant mismatches, and JWT blacklist races.
See: documentation/03-usage/03-edge-and-extreme-scenarios.md
API reference
Troubleshooting
Start here: documentation/05-quality/02-troubleshooting.md
Contributing / Security
Start here: documentation/index.md