Pull Request Opened
PR #1 opened: feat: Phase 2 - Health, Stats, Queue, and Artisan endpoints
Summary
This PR implements Phase 2 of laravel-kick, adding four new service + controller pairs for comprehensive remote introspection:
Health Endpoint (GET /kick/health)
- Database connectivity check with latency
- Cache read/write verification with latency
- Storage read/write verification with latency
- Redis check (when used separately from cache)
- Returns 200 for healthy, 503 for unhealthy
- Scope:
health:read
Stats Endpoint (GET /kick/stats)
- CPU stats (cgroups v2/v1 or system fallback)
- Memory stats (cgroups v2/v1 or system fallback)
- Disk usage with percentages
- System and PHP uptime
- Scope:
stats:read
Queue Endpoints
GET /kick/queue- Overview with job counts per queue (scope:queue:read)GET /kick/queue/failed- List failed jobs with truncated exceptions (scope:queue:read)POST /kick/queue/retry/{id}- Retry specific job (scope:queue:retry)POST /kick/queue/retry-all- Retry all failed jobs (scope:queue:retry)- Auto-detects Horizon queue configuration
Artisan Endpoints
GET /kick/artisan- List whitelisted commands (scope:artisan:list)POST /kick/artisan- Execute command with options (scope:artisan:execute)- Command whitelist enforced via
config/kick.php - Throws
CommandNotAllowedExceptionfor security
Files Changed
New Services:
src/Services/HealthChecker.phpsrc/Services/StatsCollector.phpsrc/Services/QueueInspector.phpsrc/Services/ArtisanRunner.php
New Controllers:
src/Http/Controllers/HealthController.phpsrc/Http/Controllers/StatsController.phpsrc/Http/Controllers/QueueController.phpsrc/Http/Controllers/ArtisanController.php
New Exception:
src/Exceptions/CommandNotAllowedException.php
Updated:
routes/api.php- All new routes with scopescomposer.json- PHPStan memory limit fix
Test Plan
- 94 tests passing (277 assertions)
- PHPStan level 5 clean
- Unit tests for all services
- Feature tests for all controllers
- Auth/scope tests for all endpoints
+2102
additions
-5
deletions
20
files changed