- What Laravel versions does this package support?
- Laravel Sentinel is designed for Laravel 13+ and leverages modern Laravel features like dependency injection and service providers. Always verify compatibility with your Laravel version in the package’s documentation or source code, as newer Laravel releases may introduce breaking changes.
- How do I add a custom health check for an external API?
- You can define custom checks by creating a class implementing the `HealthCheckInterface` or using a closure in the `config/sentinel.php` file. For APIs, return a boolean or structured response indicating success/failure, and optionally include details like latency or error messages for observability.
- Can I use this package alongside Laravel’s built-in health checks?
- Yes, Laravel Sentinel is designed to complement existing health checks. You can register additional checks in the configuration or middleware, and it won’t interfere with Laravel’s native `/up` or `/ready` endpoints if they’re already in use.
- Will this package slow down my application if I add many checks?
- Performance impact depends on the checks you define. Heavy operations (e.g., database queries) in `/health/ready` can introduce latency, especially in Kubernetes probes. Optimize checks by caching results or using lightweight probes for critical dependencies, and monitor response times in production.
- How do I secure the health endpoint from abuse or DDoS attacks?
- Laravel Sentinel’s endpoints can be protected using Laravel middleware like `throttle` or `ip` restrictions. For example, apply `ThrottleRequests` middleware to limit requests per minute, or restrict access to internal IPs only. Always log suspicious activity for auditing.
- Does this package support Prometheus metrics or structured JSON responses?
- The package returns structured JSON responses by default, which can be parsed by monitoring tools like Prometheus. For Prometheus integration, you may need to extend the response format or use middleware to transform the output into a metrics-compatible format.
- How do I test health checks in CI/CD pipelines?
- Test health checks by hitting the `/health` endpoint in your CI pipeline and validating the response status and structure. Use Laravel’s HTTP tests or tools like `curl` or `httpie` to simulate probes. Mock external dependencies (e.g., databases, APIs) to ensure checks behave as expected in isolated environments.
- Why is this package named 'Sentinel' if it’s for health checks, not authentication?
- The naming conflict arises from the original Cartalyst Sentinel package, which focused on authentication. Laravel Sentinel was repurposed for health checks but retains the same name. If this causes confusion in your team, consider renaming the package or documenting its purpose clearly in your project.
- Can I use this package in a non-Laravel PHP project?
- No, Laravel Sentinel is tightly coupled with Laravel’s ecosystem, including service providers, routing, and dependency injection. It won’t work outside Laravel without significant refactoring. For non-Laravel projects, consider alternatives like custom scripts or standalone monitoring tools.
- What happens if a health check fails in production? How do I debug it?
- Failed checks return a structured response with details (e.g., error messages or exceptions). Log these responses centrally for debugging, and integrate with alerting tools like PagerDuty or Slack. For persistent failures, check logs, environment variables, and dependencies (e.g., database connections) to identify root causes.