spatie/security-advisories-health-check
Laravel Health check that queries Packagist security advisories for your installed PHP packages and reports known vulnerabilities. Supports retries, result caching via Laravel cache, and ignoring specific packages for cleaner health reports.
spatie/laravel-health package, requiring minimal architectural changes.cacheResultsForMinutes()) reduces API calls but may stale data.ignorePackages() or onlyForPackages() in the check configuration.spatie/laravel-health infrastructure.Health::assert()).spatie/laravel-health (if not already present):
composer require spatie/laravel-health
composer require spatie/security-advisories-health-check
AppServiceProvider or dedicated health-check provider:
Health::checks([
SecurityAdvisoriesCheck::new()
->retryTimes(3)
->cacheResultsForMinutes(1440) // 24-hour cache
->ignorePackages(['phpunit/phpunit']), // Optional
]);
/health).storage/framework/cache).php artisan cache:clear for urgent updates).storage/framework/cache).retryTimes and cacheResultsForMinutes settings.curl to test Packagist).onlyForPackages()).retryTimes and increase cache duration.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Packagist API downtime | Health check fails, no advisory data | Enable caching; set retryTimes > 1. |
| Stale cache | Missed critical advisories | Short cache duration (e.g., 60–120 mins). |
| False positive advisories | Noise in monitoring | Use ignorePackages() or severity filtering. |
| Laravel Health misconfiguration | Check not registered | Validate service provider boot order. |
| High API latency | Slow health-check responses | Increase cache duration; run checks async. |
/health endpoint or monitoring dashboards).How can I help you explore Laravel packages today?