PHPackages                             webcrafts-studio/lens-for-laravel - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. webcrafts-studio/lens-for-laravel

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

webcrafts-studio/lens-for-laravel
=================================

A plug-and-play accessibility auditor for Laravel.

v1.1.0(1mo ago)27114↓33.3%2MITPHPPHP ^8.2

Since Mar 2Pushed 1mo agoCompare

[ Source](https://github.com/webcrafts-studio/lens-for-laravel)[ Packagist](https://packagist.org/packages/webcrafts-studio/lens-for-laravel)[ RSS](/packages/webcrafts-studio-lens-for-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (20)Versions (3)Used By (0)

Lens for Laravel
================

[](#lens-for-laravel)

**A plug-and-play accessibility auditor for Laravel applications.**

Lens for Laravel dynamically scans your local application for WCAG compliance using [Axe-core](https://github.com/dequelabs/axe-core) and attempts to reverse-engineer failing CSS selectors back to the exact **Blade file and line number** causing the issue.

**[Documentation &amp; full feature overview → lens.webcrafts.pl](https://lens.webcrafts.pl/)**

---

Features
--------

[](#features)

- **Zero frontend build step** — uses Alpine.js and Tailwind CSS via CDN; works immediately after installation
- **Powered by Axe-core** — industry-standard accessibility testing engine covering WCAG 2.x rules
- **Blade file locator** — maps compiled HTML violations back to `resources/views/**/*.blade.php` with heuristic source location detection
- **WCAG level filtering** — view issues by Level A, AA, AAA, or best-practice separately
- **Whole-site crawler** — discovers pages via sitemap or link-crawling and scans up to a configurable limit
- **Multi-URL scanning** — target specific pages in a single run
- **AI-powered fix suggestions** — generates diff previews and applies fixes directly to Blade files (supports Gemini, OpenAI, Anthropic)
- **IDE integration** — click any source location in the dashboard to open the file at the exact line in VSCode, Cursor, PhpStorm, or Sublime Text
- **Element preview** — takes a screenshot of the page with the offending element highlighted
- **PDF reports** — export full accessibility audit results as a formatted PDF
- **Artisan command** — run audits from the CLI with `lens:audit`, with support for thresholds and CI integration
- **Dark-mode dashboard** — clean developer-focused UI with direct links to WCAG and Deque rule documentation

---

Requirements
------------

[](#requirements)

RequirementVersionPHP^8.2Laravel^10.0 | ^11.0 | ^12.0 | ^13.0Node.jsany recent LTSPuppeteer^21Lens for Laravel uses [Spatie Browsershot](https://github.com/spatie/browsershot) to render JavaScript and execute Axe-core, which requires a Chromium instance managed by Puppeteer.

Install Puppeteer as a local dev dependency in your application:

```
npm install puppeteer --save-dev
```

---

Installation
------------

[](#installation)

Install as a development-only Composer dependency:

```
composer require webcrafts-studio/lens-for-laravel --dev
```

The package auto-discovers and registers its service provider. No additional configuration is required to get started.

---

Usage
-----

[](#usage)

### Dashboard

[](#dashboard)

Start your Laravel development server and navigate to:

```
http://your-app.test/lens-for-laravel/dashboard

```

Enter a URL from your local application and click **Scan Now**. Results are grouped by WCAG level and display the violation description, impacted element, estimated source file location, and links to relevant documentation.

### Artisan Command

[](#artisan-command)

Run accessibility audits directly from the terminal:

```
# Audit the application root URL
php artisan lens:audit

# Audit specific pages
php artisan lens:audit http://your-app.test/about http://your-app.test/contact

# Crawl the entire site and audit all discovered pages
php artisan lens:audit --crawl

# Filter by WCAG level
php artisan lens:audit --a      # Level A violations only
php artisan lens:audit --aa     # Level A and AA violations
php artisan lens:audit --all    # All levels including AAA and best-practice (default)

# Fail the command (exit code 1) if violations exceed a threshold — useful in CI
php artisan lens:audit --threshold=10
```

---

Configuration
-------------

[](#configuration)

Publish the configuration file to customise the package behaviour:

```
php artisan vendor:publish --tag="lens-for-laravel-config"
```

This creates `config/lens-for-laravel.php`:

```
return [
    // URL prefix for the dashboard routes
    // Default: 'lens-for-laravel'
    'route_prefix' => 'lens-for-laravel',

    // Middleware applied to all dashboard routes
    'middleware' => ['web'],

    // Environments where the dashboard is accessible
    // Add 'staging' here if you want to use it on a staging server
    'enabled_environments' => ['local'],

    // Editor opened when clicking a source location link
    // Supported: 'vscode', 'cursor', 'phpstorm', 'sublime', 'none'
    'editor' => env('LENS_FOR_LARAVEL_EDITOR', 'vscode'),

    // Maximum number of pages to crawl in whole-site scan mode
    'crawl_max_pages' => env('LENS_FOR_LARAVEL_CRAWL_MAX_PAGES', 50),

    // AI provider used for generating code fix suggestions
    // Supported: 'gemini', 'openai', 'anthropic'
    'ai_provider' => env('LENS_FOR_LARAVEL_AI_PROVIDER', 'gemini'),
];
```

---

AI Fix Suggestions
------------------

[](#ai-fix-suggestions)

The dashboard includes an AI-powered fix assistant. When a violation is expanded, you can request a suggested fix for the affected Blade snippet. The assistant returns a unified diff that can be previewed and applied directly to the file with a single click.

Configure your preferred provider and API key in `.env`:

```
LENS_FOR_LARAVEL_AI_PROVIDER=gemini   # or openai, anthropic
GEMINI_API_KEY=your-key-here
# OPENAI_API_KEY=your-key-here
# ANTHROPIC_API_KEY=your-key-here
```

---

Security
--------

[](#security)

The dashboard enforces the following protections:

- **Environment restriction** — only available in environments listed in `enabled_environments` (default: `local`)
- **Domain restriction** — the scan endpoint only accepts URLs on the same host as `APP_URL`; scanning external domains is blocked
- **Path traversal prevention** — the fix-apply endpoint restricts file writes to `resources/views`

---

Disclaimer
----------

[](#disclaimer)

Automated accessibility testing with Axe-core typically detects **20–30% of total WCAG violations**. Passing a scan in Lens for Laravel does not constitute full accessibility compliance and does not guarantee conformance with the ADA, Section 508, or the European Accessibility Act.

Always complement automated testing with:

- Manual keyboard navigation testing
- Screen reader testing (NVDA, JAWS, VoiceOver)
- Cognitive and usability walkthroughs

---

License
-------

[](#license)

The MIT License (MIT). See [LICENSE.md](LICENSE.md) for details.

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance89

Actively maintained with recent releases

Popularity25

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~18 days

Total

2

Last Release

53d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3dbe29fd7c4d8366ec55cbfbb03810ad92298cb49c16133d5a5453165493a1d0?d=identicon)[Jakub017](/maintainers/Jakub017)

---

Top Contributors

[![Jakub017](https://avatars.githubusercontent.com/u/84547080?v=4)](https://github.com/Jakub017 "Jakub017 (60 commits)")[![jakub-lipinski](https://avatars.githubusercontent.com/u/84547080?v=4)](https://github.com/jakub-lipinski "jakub-lipinski (60 commits)")[![bardolf69](https://avatars.githubusercontent.com/u/47841636?v=4)](https://github.com/bardolf69 "bardolf69 (1 commits)")[![captenmasin](https://avatars.githubusercontent.com/u/25454872?v=4)](https://github.com/captenmasin "captenmasin (1 commits)")

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/webcrafts-studio-lens-for-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/webcrafts-studio-lens-for-laravel/health.svg)](https://phpackages.com/packages/webcrafts-studio-lens-for-laravel)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[watson/active

Laravel helper for recognising the current route, controller and action

3253.6M14](/packages/watson-active)[dragon-code/pretty-routes

Pretty Routes for Laravel

10058.7k4](/packages/dragon-code-pretty-routes)[zonneplan/laravel-module-loader

Module loader for Laravel

24118.4k](/packages/zonneplan-laravel-module-loader)[bjuppa/laravel-blog

Add blog functionality to your Laravel project

483.3k2](/packages/bjuppa-laravel-blog)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
