Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laminas Diagnostics

Laminas Diagnostics Laravel Package

laminas/laminas-diagnostics

Run health checks for your PHP/Laminas apps and environments. laminas-diagnostics provides diagnostic tests and reporting for common issues, with an extensible API for custom checks and CI-friendly output.

View on GitHub
Deep Wiki
Context7

A set of components for performing diagnostic tests in PHP applications

Frequently asked questions about Laminas Diagnostics
Can I use laminas/laminas-diagnostics for real-time API health checks in Laravel?
Yes, you can integrate it as middleware to run diagnostics before API requests. For example, create a `HealthCheckMiddleware` that runs critical checks (e.g., database, cache) and returns a 503 if any fail. Results can also be logged or dispatched to a queue for async processing.
How do I install and set up laminas-diagnostics in Laravel?
Install via Composer: `composer require laminas/laminas-diagnostics`. Register a service provider in `config/app.php` to bind the diagnostics container. Then define checks in a config file or dynamically via code, and trigger them via CLI (`php artisan diagnostics:run`) or middleware.
Does laminas-diagnostics support Laravel’s task scheduler for periodic checks?
Yes, you can schedule diagnostics using Laravel’s scheduler in `app/Console/Kernel.php`. For example, add `Schedule::command('diagnostics:run --suite=database')->daily()` to run database health checks nightly. Results can be logged or sent to monitoring tools.
What Laravel versions does laminas-diagnostics support?
The package itself is PHP-agnostic but works with Laravel 8+ due to its PSR-11 container compatibility. Test thoroughly with your Laravel version, as some features (e.g., queue integration) may require minor Laravel-specific wrappers. Check the Laminas docs for PHP version requirements.
How can I customize diagnostics for Laravel-specific services like queues or cache?
Extend the base `Diagnostic` class to create Laravel-specific checks. For example, use `Cache::store()` or `Queue::connection()` in your custom diagnostic logic. Wrap results in Laravel’s logging or notification systems (e.g., `Notification::send()` for alerts).
Will laminas-diagnostics impact performance in high-traffic Laravel apps?
Minimal if used judiciously. Avoid running heavy checks in real-time middleware; instead, use scheduled commands or background jobs (e.g., Laravel queues). For APIs, limit checks to critical services (e.g., database, external APIs) and cache results where possible.
Can I integrate laminas-diagnostics with Laravel Telescope or Horizon?
Yes, you can log diagnostic results to Telescope by extending its `Monitor` class or using Monolog handlers. For Horizon, dispatch diagnostic jobs to a queue and process them asynchronously. Both tools provide real-time visibility into system health.
Are there alternatives to laminas-diagnostics for Laravel health checks?
Yes, consider `spatie/laravel-health` for Laravel-specific health checks or `spatie/laravel-monitoring` for broader observability. For distributed systems, tools like `prometheus_client_php` or `laravel-prometheus` may fit better. Laminas Diagnostics offers more flexibility for custom checks but requires manual Laravel integration.
How do I test laminas-diagnostics in a Laravel test suite?
Use Laravel’s testing tools (PHPUnit/Pest) to mock external services (e.g., database, cache) and verify diagnostic outcomes. For example, test a `DatabaseHealthCheck` by simulating a connection failure and asserting the diagnostic returns a `Failed` status. Use `Mockery` or Laravel’s `fake()` helpers for isolation.
What happens if a diagnostic check itself fails in production?
Design checks to be resilient—wrap logic in try-catch blocks and log failures gracefully. For critical systems, implement fallback mechanisms (e.g., return cached results or a degraded state). Use Laravel’s `try-catch` in middleware or queue jobs to handle diagnostic failures without crashing the app.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor
spatie/laravel-javascript-views