devguard / php-guard
DevGuard standalone PHP guard middleware for remote project locking, invoice milestone autolock, and domain allowlisting.
v1.0.1
2026-11-22 16:00 UTC
Requires
- php: >=7.4
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-22 16:02:03 UTC
README
Zero-dependency PHP middleware for remote project locking, invoice milestone autolock enforcement, domain allowlisting, and SEO-safe HTTP 503 maintenance pages.
Installation
composer require devguard/php-guard
Quick Start
use DevGuard\WebGuard; $guard = new WebGuard([ 'projectId' => 'proj_your_project_id', 'apiUrl' => 'https://api.devguard.uk', 'failSafe' => 'open', // Defaults to 'open' (never crashes production on network blips) 'cacheTtl' => 60, // Cache status for 60 seconds ]); // Enforce protection (renders HTTP 503 lock screen and exits if locked or domain unauthorized) $guard->enforce();
Standalone Check (No Auto-Exit)
$result = $guard->check(); if (!$result['allowed']) { // Custom handling error_log("DevGuard locked: " . $result['reason']); }
Security Features
- Wildcard Domain Allowlisting: Enforces exact domains and
*.domain.comsubdomains while strictly preventing suffix/prefix spoofing attacks. - Fail-Safe Open: Network timeouts and API blips will never crash your site.
- SEO-Safe HTTP 503: Sends
Retry-After: 3600,X-Robots-Tag: noindex, nofollow, noarchive, andCache-Control: no-storeso search engine rankings are preserved during maintenance. - Zero Dependencies: Pure PHP 7.4 - 8.4+.