Download the PHP package jbsommeling/scannr without Composer
On this page you can find all versions of the php package jbsommeling/scannr. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jbsommeling/scannr
More information about jbsommeling/scannr
Files in jbsommeling/scannr
Package scannr
Short Description A Laravel package that crawls websites to detect broken links, redirect chains, HTTPS downgrades, and more. Includes JavaScript rendering support for SPAs.
License MIT
Homepage https://github.com/JBSommeling/scannr
Informations about the package scannr
Scannr
Scannr crawls your website and reports broken links, redirect chains, HTTPS downgrades, and other link-health problems, then scores the site from 0 to 100. Run it from Artisan as a dev dependency in a Laravel project, or as a Docker-based GitHub Action that can fail a build when the score drops.
What it checks
Scannr crawls breadth-first from a starting URL, optionally seeded from your sitemap (XML,
HTML, plain text, or sitemap index). On each page it collects URLs from <a>, <link>,
<script>, <img>, media elements, download triggers, and inline JS handlers, then requests
each one and records:
- broken links (4xx and 5xx responses) and timeouts;
- redirect chains, including loops;
- redirects that downgrade from HTTPS to HTTP;
- flags on every link describing how it was found, platform traits, technical anomalies, and the validation outcome.
Sites that render in the browser (React, Vue, Angular) can be scanned with a headless browser,
either always (--js) or only when Scannr detects an SPA (--smart-js).
Scannr respects robots.txt Disallow rules and Crawl-delay, backs off exponentially on
HTTP 429, and hides noise such as XML namespaces, CDN preconnect hints, and JS framework error
docs unless you pass --advanced. Results come out as a table, JSON, or CSV.
Installation
The service provider is auto-discovered. Publish the config if you want to change defaults (see Configuration):
--queue stores results in the database, so it needs the migration:
--js and --smart-js need Node.js and Puppeteer:
Running a scan
Common variations:
Options
| Option | Default | Description |
|---|---|---|
--depth=N |
3 | Maximum crawl depth from the starting URL |
--max=N |
300 | Maximum number of URLs to scan |
--timeout=N |
5 | Request timeout in seconds |
--format=FORMAT |
table | Output format: table, json, or csv |
--status=FILTER |
all | Show all, ok, or broken results |
--filter=TYPE |
all | Show only one element type: all, a, link, script, img, media, form |
--scan-elements=TYPES |
all | Element types to scan: all, or comma-separated (e.g. a,img) |
--sitemap |
off | Discover URLs from the sitemap before crawling |
--js |
off | Render every page with a headless browser |
--smart-js |
off | Render with a headless browser only when an SPA is detected |
--no-robots |
off | Ignore robots.txt rules |
--advanced |
off | Show noise URLs (XML namespaces, CDN hints, etc.) |
--strip-params=PARAMS |
— | Extra tracking parameters to strip (comma-separated) |
--delay-min=N |
config | Minimum delay between requests, in ms |
--delay-max=N |
config | Maximum delay between requests, in ms |
--queue |
off | Run the scan as a background job |
--fail-on-broken |
off | Exit 1 if any link is broken |
--fail-on-critical |
off | Exit 1 if any critical issue is found |
--min-rating=GRADE |
none | Exit 1 below this rating: excellent, good, needs_attention, or none |
Integrity score and quality gates
Every scan ends with an integrity score from 0 to 100, built from five components: link integrity, security hygiene, technical hygiene, redirect health, and link verifiability. The score maps to a grade:
| Grade | Score |
|---|---|
| Excellent | 90 and above |
| Good | 75 and above |
| Needs Attention | 50 and above |
| Critical | below 50 |
Penalty weights and grade thresholds live in config/scannr.php.
A scan only fails, with exit code 1, when you ask it to: --fail-on-broken,
--fail-on-critical, or --min-rating. Without them the exit code is 0 however bad the
results are. The same holds for the GitHub Action.
Example output
Table (default)
JSON (--format=json)
GitHub Action
Without fail-on-broken, fail-on-critical, or min-rating, the step reports results but
never fails.
Inputs
Every CLI option except --queue is available as an input of the same name. Only url is
required.
Outputs
| Output | Description |
|---|---|
exit-code |
0 on success, 1 when a quality gate failed |
score |
Integrity score, 0–100 |
grade |
Excellent, Good, Needs Attention, or Critical |
broken-count |
Number of broken links |
critical-count |
Number of critical issues |
Examples
Scan an SPA and show only broken links:
Report without failing, then act on the counts in a later step:
Weekly deep audit seeded from the sitemap:
Strict gate that requires an Excellent rating:
Scan only sites you own
Scannr is meant for websites you own or have explicit permission to test. You are responsible
for staying within the site's terms of service, applicable law, and its robots.txt. Don't
use it to crawl sites without permission, overload servers, get around rate limits, or reach
protected or private content. The authors are not responsible for misuse.
Two checks back this up:
Artisan compares the scan URL's domain with APP_URL and warns on a mismatch. It does
not block the scan, since scanning a staging or production domain from a local checkout is
normal.
The GitHub Action reads an optional .scannr.yml in the repository root. If the file
exists, the action blocks any URL whose domain isn't listed:
Without .scannr.yml, the action trusts the url input, because you control the workflow
file.
Configuration
php artisan vendor:publish --tag=scannr-config creates config/scannr.php, where you can
change:
- tracking parameters stripped during URL normalization (
utm_*,fbclid, etc.); - the User-Agent sent with requests;
- request delays and 429 backoff;
- hard caps on depth and URL count;
- paths to the Node, npm, and Chrome binaries used for JS rendering;
- noise filtering: namespace domains, preconnect hints, framework error patterns;
- scoring: penalty weights, confidence multipliers, grade thresholds;
- external platforms with known bot protection (LinkedIn, GitHub, etc.).
Testing
License
MIT. See the license.
All versions of scannr with dependencies
ext-libxml Version *
ext-simplexml Version *
guzzlehttp/guzzle Version ^7.15.2|^8.0.1
illuminate/console Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
spatie/browsershot Version ^5.2
symfony/css-selector Version ^7.0|^8.0
symfony/dom-crawler Version ^7.0|^8.0