malikad778/laravel-blade-ally
Composer 安装命令:
composer require malikad778/laravel-blade-ally
包简介
Static Accessibility Analyzer for Laravel Blade & Livewire Templates
README 文档
README
Static Accessibility Analyzer for Laravel Blade & Livewire Templates
Catch WCAG 2.2 AA violations in your PHP source code before a single request is served.
Why laravel-blade-ally Exists
The European Accessibility Act (EAA) came into force in June 2025. WCAG AA compliance is now a legal requirement for public-facing web applications across the EU.
Existing tools like axe-core, Lighthouse, and WAVE run in the browser at runtime—after your code has been deployed. They catch nothing in CI. They cannot easily analyze dynamic Blade conditionals, Livewire component trees, or slot-rendered layouts, and they require a running server.
laravel-blade-ally is the missing layer: a static analysis engine that parses your Blade templates and Livewire components as source code, detects WCAG violations before compilation, and integrates into your CI/CD pipeline—acting just like PHPStan but for your frontend accessibility.
🚀 Installation
You can install the package via composer (typically as a development dependency):
composer require malikad778/laravel-blade-ally --dev
You can publish the configuration file using:
php artisan ally:init
This will publish the blade-ally.php config file to your config/ directory.
🛠️ Usage
Run the static analyzer across your entire resources/views and app/Livewire directories:
php artisan ally:analyze
Options
- Specify paths:
php artisan ally:analyze resources/views/components app/Livewire - Change output format:
php artisan ally:analyze --format=json(Available formats:terminal,json,html,checkstyle,github,sarif,junit) - Filter by severity:
php artisan ally:analyze --severity=error
Understand a Rule
If you want to know why a specific rule failed or how to fix it:
php artisan ally:explain img-missing-alt
Working with Baselines
Just like PHPStan, you can create a baseline to ignore existing legacy violations and only enforce rules on new code:
php artisan ally:baseline
Subsequent runs of ally:analyze will automatically ignore the violations recorded in the baseline file.
✨ Feature Overview
Core Engine
- Full Blade Parser: Understands
@if,@foreach,@include,@extends,@yield,<x-components>, and<x-slot>layouts. - Smart Livewire Analyzer: Understands
wire:click,wire:loading,wire:navigate, and correlates Livewire PHP class logic with the component's Blade view. - Alpine.js Aware: Respects
x-on:click,x-show, and dynamically bound Alpine attributes. - CI/CD Ready: Returns hard exit codes on failures. Native support for GitHub Annotations and SARIF (for GitHub Code Scanning security tabs).
Complete WCAG Coverage (73 Rules Across 13 Categories)
The engine currently validates exactly 73 distinct criteria, including:
- Images & Media (SC 1.1.1, 1.2.x): Enforces meaningful
alttext, prevents redundant filenames in alts, enforces<svg>titles, catchesdivbackgrounds used as generic images, and checks for<video>captions. - Forms (SC 1.3.1, 3.3.2): Validates implicit and explicit
<label>connections. Ensures required fields have correctaria-requiredtags, and input validation is properly linked viaaria-describedbyorrole="alert". - Buttons & Links (SC 2.4.4, 4.1.2): Catches empty links, generic "click here" text, Javascript
hrefvoids, and<div role="button">missing keyboard tabindexes. - Tables & Structure (SC 1.3.1): Enforces correct
<th>scopes, catches skipped heading levels (e.g.,h2toh4), missing<main>landmarks, and duplicate<h1>tags. - Modals & Dialogs (SC 4.1.2): Enforces
role="dialog", trapped focus management, and@keydown.escapehandlers. - ARIA Verification (SC 4.1.2): Prevents impossible ARIA roles, validates parent/child ARIA associations (e.g.
role="rowheader"must be inside a row container), and preventsaria-hiddenon focusable elements. - Livewire Specific:
livewire-poll-no-pause: Enforceswire:poll.visiblefor performance and screen-reader sanity.wire-loading-aria-live: Ensures visualwire:loadingstates are announced to screen readers.livewire-dispatch-focus: Tracks missing focus management when Livewire dispatches DOM-altering events.
⚙️ Configuration
Your config/blade-ally.php allows fine-grained control over the analysis:
return [ 'paths' => [ resource_path('views'), app_path('Livewire'), ], // Ignore specific files or directories 'exclude_paths' => [ resource_path('views/vendor'), ], // Toggle individual rules 'rules' => [ 'img-alt-filename' => false, // Disable specific rule 'heading-multiple-h1' => true, ], ];
🔄 Continuous Integration
laravel-blade-ally is designed for automated checks.
GitHub Actions Example
name: Accessibility Analysis on: [push, pull_request] jobs: blade-ally: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: '8.2' - run: composer install --prefer-dist --no-progress - name: Run Blade Ally run: php artisan ally:analyze --format=github
Using --format=github will place inline annotations directly on your Pull Request files!
🧪 Testing
We use Pest/PHPUnit to ensure parser integrity and rule accuracy:
composer test
(Tests cover HTML implicit semantics, Blade tokenization, Livewire bindings, and AST traversal).
📄 License
The MIT License (MIT). Please see License File for more information.
malikad778/laravel-blade-ally 适用场景与选型建议
malikad778/laravel-blade-ally 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「accessibility」 「blade」 「static-analysis」 「wcag」 「livewire」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 malikad778/laravel-blade-ally 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 malikad778/laravel-blade-ally 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 malikad778/laravel-blade-ally 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Provide accessibility and SEO insights of your page in Symfony profiler
A Statamic addon that automates the generation of image alt texts using AI, enhancing web accessibility and SEO with minimal effort.
Make emoji more accessible
Alfabank REST API integration
Modern gives the Matomo user interface a minimalist look and feel. Now also with dark mode and additional options.
Render blade templates into a PSR-7 Response object.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 38
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-13