traffic-orchestrator / laravel
Official Laravel integration for Traffic Orchestrator license validation
2.0.0
2026-03-28 04:28 UTC
Requires
- php: ^8.1
- illuminate/support: ^10.0|^11.0
README
Official Laravel integration for Traffic Orchestrator.
📖 API Reference · SDK Guides · OpenAPI Spec
Install
composer require traffic-orchestrator/laravel
Configuration
php artisan vendor:publish --provider="TrafficOrchestrator\Laravel\ServiceProvider"
Set in .env:
TO_API_KEY=sk_live_xxxxx
Service Provider + Facade
// Auto-registered via package discovery. Use the facade: use TrafficOrchestrator\Laravel\Facades\TO; $result = TO::validateLicense($token, $domain);
Facade Methods
| Method | Auth | Description |
|---|---|---|
TO::validateLicense($token, $domain) |
No | Validate a license key |
TO::verifyOffline($token) |
No | Ed25519 offline verification |
TO::listLicenses() |
Yes | List all licenses |
TO::createLicense($options) |
Yes | Create a new license |
TO::rotateLicense($id) |
Yes | Rotate license key |
TO::deleteLicense($id) |
Yes | Revoke a license |
TO::addDomain($id, $domain) |
Yes | Add domain to license |
TO::removeDomain($id, $domain) |
Yes | Remove domain from license |
TO::getUsage() |
Yes | Get usage statistics |
TO::healthCheck() |
No | Check API health |
Middleware
// routes/web.php Route::middleware('license:pro')->group(function () { Route::get('/premium', [PremiumController::class, 'index']); });
Register in app/Http/Kernel.php:
'license' => \TrafficOrchestrator\Laravel\Middleware\VerifyLicense::class,
Multi-Environment
# .env (Production) TO_API_KEY=sk_live_xxxxx # .env.staging TO_API_KEY=sk_test_xxxxx TO_API_URL=https://api-staging.trafficorchestrator.com/api/v1
Offline Verification (Enterprise)
Validate licenses locally without API calls using Ed25519 JWT signatures:
// Add TO_PUBLIC_KEY to your .env $result = TO::verifyOffline($licenseToken); if ($result->valid) { echo "Plan: " . $result->planId; }
Requirements
- PHP 8.0+
- Laravel 9+
License
MIT