devguard / devguard-laravel
DevGuard Anti-Theft, Domain Allowlisting, and Milestone Autolock Middleware for Laravel
v1.0.1
2026-11-22 16:00 UTC
Requires
- php: >=7.4 || >=8.0
- devguard/php-guard: ^1.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Official Laravel package for DevGuard anti-theft protection, domain allowlisting, invoice milestone autolock enforcement, and SEO-safe HTTP 503 lockouts.
Features
- Auto-Discovery: Automatically registers
DevGuardServiceProvideranddevguardmiddleware alias. - Fail-Safe Open Policy: Network timeouts, DNS issues, or unreachable APIs will never bring down your production application.
- Milestone Autolock: Automatically syncs due-dates and delinquency states with your DevGuard dashboard.
- Domain Authorization: Enforces authorized hosting domains with support for wildcard subdomains (
*.example.com). - SEO Preservation: Returns
503 Service UnavailablewithRetry-After: 3600so Google and search engines never de-index your site during temporary disputes. - Artisan Commands: Includes
php artisan devguard:statusandphp artisan devguard:lock.
Installation
Install via Composer:
composer require devguard/devguard-laravel
Publish the configuration file (optional):
php artisan vendor:publish --tag="devguard-config"
Configuration
Add the following environment variables to your .env file:
DEVGUARD_ENABLED=true DEVGUARD_PROJECT_ID=your_project_id_here DEVGUARD_API_URL=https://api.devguard.uk # Prefer project SDK key (Portal → Project SDK key). Falls back to DEVGUARD_API_KEY. DEVGUARD_SDK_KEY=your_project_sdk_key DEVGUARD_ALLOWED_DOMAINS=example.com,*.example.com DEVGUARD_FAIL_SAFE=open DEVGUARD_CACHE_TTL=300
Middleware Usage
Laravel 11 (bootstrap/app.php):
->withMiddleware(function (Middleware $middleware) { $middleware->append(\DevGuard\Laravel\Http\Middleware\DevGuardMiddleware::class); })
Laravel 9 & 10 (app/Http/Kernel.php):
Add to your global or web middleware stack:
protected $middlewareGroups = [ 'web' => [ // ... \DevGuard\Laravel\Http\Middleware\DevGuardMiddleware::class, ], ];
Or apply to specific route groups:
Route::middleware(['devguard'])->group(function () { Route::get('/', [HomeController::class, 'index']); });
Artisan Commands
Check Project & Lock Status
php artisan devguard:status
Emergency Local Lock
php artisan devguard:lock --toggle php artisan devguard:lock --unlock