PHPackages                             dwebserver/laravel-sanity-check - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. dwebserver/laravel-sanity-check

ActiveLibrary[Testing &amp; Quality](/categories/testing)

dwebserver/laravel-sanity-check
===============================

Laravel admin dashboard and Artisan command to scan routes, resolve parameters, execute HTTP checks, classify responses, and optionally persist results with JSON/CSV export.

v0.0.1(3mo ago)02[3 PRs](https://github.com/dwebserver/laravel-sanity-check/pulls)MITPHPPHP ^8.1CI passing

Since Mar 22Pushed 1mo agoCompare

[ Source](https://github.com/dwebserver/laravel-sanity-check)[ Packagist](https://packagist.org/packages/dwebserver/laravel-sanity-check)[ Docs](https://github.com/dwebserver/laravel-sanity-check)[ RSS](/packages/dwebserver-laravel-sanity-check/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (1)Dependencies (12)Versions (5)Used By (0)

dwebserver/laravel-sanity-check
===============================

[](#dwebserverlaravel-sanity-check)

[![CI](https://github.com/dwebserver/laravel-sanity-check/actions/workflows/ci.yml/badge.svg)](https://github.com/dwebserver/laravel-sanity-check/actions/workflows/ci.yml)[![Latest Stable Version](https://camo.githubusercontent.com/fa666c4a53522019f10865fd7badd05a91e4ec2a32d75a40d365c637588775a2/68747470733a2f2f706f7365722e707567782e6f72672f647765627365727665722f6c61726176656c2d73616e6974792d636865636b2f762f737461626c65)](https://packagist.org/packages/dwebserver/laravel-sanity-check)[![License](https://camo.githubusercontent.com/d1892d7eb3fc4e453a9cfe89d01ceaef05ba4ba619da0edc2691eff9c705d431/68747470733a2f2f706f7365722e707567782e6f72672f647765627365727665722f6c61726176656c2d73616e6974792d636865636b2f6c6963656e7365)](https://packagist.org/packages/dwebserver/laravel-sanity-check)[![PHP Version Require](https://camo.githubusercontent.com/7d7bb82196785f736c592d9158867528e825127acddd68ffa03b7de0a69dc5be/68747470733a2f2f706f7365722e707567782e6f72672f647765627365727665722f6c61726176656c2d73616e6974792d636865636b2f726571756972652f706870)](https://packagist.org/packages/dwebserver/laravel-sanity-check)[![Monthly Downloads](https://camo.githubusercontent.com/03563792ff1a6df486c3bad6b02b79c932fee3aea6f99d34562ea0903c54cc0b/68747470733a2f2f706f7365722e707567782e6f72672f647765627365727665722f6c61726176656c2d73616e6974792d636865636b2f642f6d6f6e74686c79)](https://packagist.org/packages/dwebserver/laravel-sanity-check)

**Repository:** [github.com/dwebserver/laravel-sanity-check](https://github.com/dwebserver/laravel-sanity-check) · **Contact:**  · **Maintainer guide:** [`docs/releasing.md`](docs/releasing.md)

---

Table of contents
-----------------

[](#table-of-contents)

1. [Overview](#1-overview)
2. [Features](#2-features)
3. [Screenshots and UI overview](#3-screenshots-and-ui-overview)
4. [Installation](#4-installation)
5. [Publish config, migrations, and views](#5-publish-config-migrations-and-views)
6. [Basic usage](#6-basic-usage)
7. [Dashboard usage](#7-dashboard-usage)
8. [Artisan usage](#8-artisan-usage)
9. [Configuration reference](#9-configuration-reference)
10. [Route parameter resolvers](#10-route-parameter-resolvers)
11. [Authorization](#11-authorization)
12. [Persistence and cleanup](#12-persistence-and-cleanup)
13. [JSON export](#13-json-export)
14. [CI usage example](#14-ci-usage-example)
15. [Testing](#15-testing)
16. [Release process](#16-release-process)
17. [Packagist publication](#17-packagist-publication)
18. [Roadmap](#18-roadmap)
19. [Contributing](#19-contributing)
20. [License](#20-license)

---

1. Overview
-----------

[](#1-overview)

**Laravel route sanity checks for back-office teams.** This package adds an optional **admin dashboard** and an **Artisan command** that discover your application routes, resolve dynamic URL segments where possible, execute requests (via the HTTP kernel or an outbound HTTP client), and classify outcomes into summary buckets (2xx–5xx and ignored). Results can be **persisted** for history and trends, or kept **ephemeral** for one-off smoke tests. **JSON** (and optional **CSV**) export helps you plug results into monitoring, tickets, or CI artifacts.

Install it when you want **repeatable smoke coverage** of GET/HEAD (and optionally other) routes across **staging and CI**, without replacing full browser E2E suites. It complements—not replaces—feature tests and production APM.

---

2. Features
-----------

[](#2-features)

- **Route discovery** — Scans the Laravel router with configurable filters: name/URI prefixes, include/exclude patterns (`Str::is`), HTTP methods (default GET/HEAD with sensible HEAD deduplication), caps via `max_routes_per_run`.
- **Safe defaults** — Optional skipping of **signed** URLs, **throttled** routes, **closure** actions, and **vendor** package routes so scans focus on your app.
- **Two execution modes** — **`internal`**: `Request::create` + HTTP kernel (no outbound TCP; respects middleware). **`http`**: HTTP client against `APP_URL` (better for strict timeouts; see auth caveats below).
- **Response classification** — Maps results into legacy summary buckets (2xx, 3xx, 4xx, 5xx, ignored) with configurable redirect handling and ignored status codes (e.g. 419).
- **Blade dashboard** — Run checks from the browser, inspect the latest saved run, paginate and filter per bucket, optional run history.
- **Artisan command** — `sanity-check:run` with JSON output, `--no-save`, `--only` / `--except` / `--limit`; **non-zero exit** when any route lands in the **5xx** bucket (CI-friendly).
- **Persistence** — Optional database storage with **max run count** and **retention by day** pruning.
- **Exports** — JSON endpoints (on by default); CSV download optional.
- **Extension points** — Swap `RouteScanner`, `RouteTester`, or `ResultRepository` via config bindings; chain **parameter resolvers** for `{slug}` / `{id}` segments.
- **Production guardrails** — `allow_in_production`, `environment_allowlist`, and dashboard/command toggles.

---

3. Screenshots and UI overview
------------------------------

[](#3-screenshots-and-ui-overview)

Replace the placeholders below after you capture screenshots in your environment (recommended: light and dark theme, post-run summary + bucket tables).

AreaPlaceholderDashboard (index)[![Dashboard index](docs/screenshots/dashboard-index.png)](docs/screenshots/dashboard-index.png)Run detail / buckets[![Run detail](docs/screenshots/dashboard-run-detail.png)](docs/screenshots/dashboard-run-detail.png)History panel[![History](docs/screenshots/dashboard-history.png)](docs/screenshots/dashboard-history.png)**UI overview (no images required):**

- **Index** — Default landing at `{dashboard_path}` (configurable, default `admin/sanity-check`). Shows the latest saved run when `save_runs` is true, or prompts to run when empty. **Run checks** submits a POST to `sanity-check.run`.
- **Run detail** — `GET {dashboard_path}/runs/{uuid}` (`sanity-check.show`). Per-route rows grouped into buckets with pagination query params `p_2xx`, `p_3xx`, etc.
- **Theme** — `ui_theme` is exposed on `` as `sanity-theme--{value}` (default `dark`) for your admin layout/CSS.
- **Ephemeral runs** — With `save_runs=false`, the last run may still be reviewed via redirect/query flows documented in config; durable history is disabled.

---

4. Installation
---------------

[](#4-installation)

Requirements: **PHP 8.1+**, **Laravel 10 / 11 / 12** (see `composer.json` `illuminate/*` constraints).

```
composer require dwebserver/laravel-sanity-check
```

Laravel will **auto-discover** `DynamicWeb\SanityCheck\SanityCheckServiceProvider` via `extra.laravel.providers`. Manual registration is only needed if discovery is disabled in your app.

---

5. Publish config, migrations, and views
----------------------------------------

[](#5-publish-config-migrations-and-views)

```
# Full commented config (recommended starting point)
php artisan vendor:publish --tag=sanity-check-config

# Database migrations (optional copy; the package also loads migrations automatically—pick one strategy)
php artisan vendor:publish --tag=sanity-check-migrations

# Blade views (optional overrides)
php artisan vendor:publish --tag=sanity-check-views
```

Apply migrations when using SQL persistence:

```
php artisan migrate
```

**Important:** If you rely on the package’s **automatic migration loading**, avoid also running duplicate copies of the same migration files. Either publish migrations **or** use the package registration— not both for the same tables.

---

6. Basic usage
--------------

[](#6-basic-usage)

**Typical back-office use case:** After deploy, an operator opens the dashboard under `/admin/sanity-check`, runs a check against GET routes scoped to `admin.*` (via config), and scans for unexpected 5xx or redirects.

**Typical CI use case:** Pipeline runs `php artisan sanity-check:run --no-save --only="admin.*"` and fails the job if any server error appears.

Minimal configuration after publishing:

```
