Implement $wire binding validation for Livewire components#1
Draft
Implement $wire binding validation for Livewire components#1
Conversation
Co-authored-by: tnylea <601261+tnylea@users.noreply.github.com>
Co-authored-by: tnylea <601261+tnylea@users.noreply.github.com>
Co-authored-by: tnylea <601261+tnylea@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Please implement the following check. When the user runs
Implement $wire binding validation for Livewire components
Sep 14, 2025
php artisan fuse:check we need to parse through all the Livewire components and verify that all the wire:click, wire:bind, and $wire. have corresponding methods or properties. here's the speck ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements the first check for Fuse: $wire Binding Validation. This feature validates that every
$wirereference in Blade templates and AlpineJS code maps to a real public property or method on your Livewire component, preventing broken bindings before they hit production.What's New
php artisan fuse:checkCommandA new Artisan command that scans your Livewire components and their associated Blade templates to validate all wire bindings.
Comprehensive Validation Coverage
Wire Directives: Validates all common Livewire directives including:
wire:model,wire:click,wire:submitwire:keydown,wire:keyup,wire:changewire:input,wire:blur,wire:focusAlpineJS $wire References: Validates both property access and method calls:
$wire.propertyName- validates property exists$wire.methodName()- validates method exists and is publicNested Properties: Correctly handles nested property bindings like
wire:model="user.name"by validating the root property exists.Example Usage
Given a Livewire component:
And a Blade template with issues:
The command will output:
Architecture
The implementation follows a clean, modular architecture:
FuseCheckCommand: Artisan command entry point with colorized outputWireBindingChecker: Orchestrates the validation processLivewireComponentParser: Analyzes PHP component files using reflection to extract public properties and methodsBladeTemplateParser: Uses regex patterns to extract wire directives and $wire references from Blade templatesComponent Discovery
Automatically discovers Livewire components in standard locations:
app/Livewire/app/Http/Livewire/And finds associated Blade templates in:
resources/views/livewire/Error Handling
This implementation provides a solid foundation for catching Livewire binding issues early in development, matching the specification in the README for check #1: "$wire Binding Validation".
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638/usr/bin/php8.3 -n -c /tmp/IHo57V /usr/bin/composer install(http block)https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991/usr/bin/php8.3 -n -c /tmp/IHo57V /usr/bin/composer install(http block)If you need me to access, download, or install something from one of these locations, you can either:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.