PHP code example of ronu / laravel-app-context
1. Go to this page and download the library: Download ronu/laravel-app-context library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ronu / laravel-app-context example snippets
'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,
],
],
],
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(),
]);
});
});
Route::middleware(['app-context', 'app. => ['ok' => true]);
});
Route::middleware(['app-context', 'app.) => ['ok' => true]);
});
Route::middleware(['app-context', 'app.scope:admin:*'])->group(function () {
Route::get('/api/admin/metrics', fn () => ['ok' => true]);
});
bash
php artisan vendor:publish --tag=app-context-config