edulazaro/wirefence
WireFence is a Laravel/PHP package by edulazaro that provides a lightweight, expressive fence for protecting application boundaries, helping you define and enforce access rules around routes, resources, and components with minimal configuration.
Wirefence is a Laravel package for declaring "fences" — explicit boundaries around parts of your application (routes, Livewire components/actions, or service-layer entry points) that control who can cross them and under what conditions. Version 1.0.0 is the first stable release, so the public API is now the one to build against.
Start here, in order:
composer.json — confirm the PHP and Laravel version constraints before installing. At 1.0.0 the support matrix is now fixed; don't assume it matches your app.src/*ServiceProvider.php) — this tells you what the package actually registers: config merge/publish, middleware aliases, facade or singleton bindings, Blade/Livewire directives, and any artisan commands. Read this before wiring anything up.tests/ — at a 1.0.0 with a sparse changelog, the tests are the most reliable description of intended behavior. Look for the feature tests that assert allow/deny outcomes; they double as copy-paste examples.Minimal first use case: install, publish the config (php artisan vendor:publish --tag=wirefence-config — confirm the tag in the README), and fence a single low-risk route or component in a local environment. Verify the default decision (deny-by-default vs. allow-by-default) on that one boundary before rolling fences out anywhere else. Getting the default posture right up front prevents a silent open door.
Fence at the boundary, not in the middle. Apply fences where requests enter — route middleware, a Livewire lifecycle hook, a form request, or a controller/action trait — rather than sprinkling checks through your domain code. Domain services should stay fence-agnostic so they remain testable in isolation.
Layer with native authorization. Use Laravel gates and policies for "who is this user and what may they do," and use Wirefence for "is this entry point open, from where, and how often." Treating the fence as a second, coarser layer keeps your policies reusable and your fences declarative.
Define rules centrally. Prefer config- or attribute-driven fence definitions over inline closures scattered across controllers. Central definitions are auditable, diffable in review, and cacheable. If the package supports class-based rules/resolvers, use those for anything with branching logic.
Test the fence, not just the happy path. For every fenced boundary, write a feature test for the allowed case and the denied case, asserting the actual response (403 vs. redirect vs. silent abort). If the package ships testing helpers, use them; otherwise assert at the HTTP/Livewire level so you're testing real behavior.
Environment-specific posture. Keep fences strict in production and staging, and consider an explicit permissive profile for local/CI so local development isn't friction-heavy. Make that difference visible in config rather than hidden in conditionals.
Integration points to check deliberately: queued jobs and scheduled commands (does the fence apply outside HTTP?), API routes versus web routes, and any place you call an action directly rather than through the framework — a fence enforced by middleware will not protect a direct in-process call.
"edulazaro/wirefence": "1.0.0") and read the diff between 1.0.0 and any 1.0.x patch before upgrading. Don't float on ^1.0 blindly during the first weeks of a new stable line.php artisan config:cache in your deploy pipeline and verify the fences still apply. Closures in config files break config:cache — convert them to class references if you hit LogicException: Your configuration files are not serializable.bootstrap/app.php or Kernel.php depending on your Laravel version.->call() or action invocation, not just the initial mount — a fence that looks fine on render can be bypassed on update.How can I help you explore Laravel packages today?