foxws/livewire-use
foxws/livewire-use is a Laravel Livewire package by Foxws that makes it easy to reuse and compose component logic with a simple, expressive API. It reduces boilerplate, keeps Livewire components clean and testable, and integrates seamlessly into existing Laravel and Livewire projects.
Install and verify compatibility first.
composer require foxws/livewire-use
composer show foxws/livewire-use # version, requires, autoload
Before writing a single line of code, check composer.json inside vendor/foxws/livewire-use for the livewire/livewire constraint. This package targets Livewire 3 conventions; if you are still on Livewire 2 the traits will not boot correctly. Also check extra.laravel.providers — most utility packages of this shape ship no service provider and no config file, in which case installation is nothing more than the composer require.
Where to look first. Because the package has zero stars and zero dependents, treat the README as a marketing blurb and the source as the documentation:
ls vendor/foxws/livewire-use/src
rg "^(trait|abstract class|class) " vendor/foxws/livewire-use/src
rg "function boot|function initialize|function mount" vendor/foxws/livewire-use/src
That last command is the most important one — it tells you which traits hook into the Livewire lifecycle and therefore which ones can silently interfere with your component.
First use case. Do not adopt the whole collection at once. Pick the single trait that solves a problem you already have (typically cached/computed properties, query-string syncing, polling, or dirty-state guards), apply it to one component, and exercise that component end to end:
use Foxws\LivewireUse\Concerns\SomeTrait; // confirm exact namespace from src/
class SearchPosts extends Component
{
use SomeTrait;
public string $term = '';
}
Then run the page, hit the interactive parts, and refresh once to confirm the behavior survives a full request. If it does, keep going; if not, you have lost ten minutes instead of a sprint.
Compose, don't scatter. The sustainable pattern with a low-traffic utility package is to create a thin application-level trait or base component that composes the package traits, so the dependency appears in exactly one place:
namespace App\Livewire\Concerns;
trait UsesLivewireUtilities
{
use \Foxws\LivewireUse\Concerns\TraitA;
use \Foxws\LivewireUse\Concerns\TraitB;
}
When the package is abandoned or a trait changes shape, you edit one file rather than forty components.
Trait-per-concern in components. Utilities in this family usually fall into recognizable buckets: cached/computed derived state, URL query-string binding, polling and refresh intervals, unsaved-changes and dirty tracking, model resolution shortcuts, and small testing helpers. Apply each trait only to the components that need it. A component that only needs query-string sync should not inherit polling behavior it will never use — every trait you use is code that runs (or at least is reflected on) for every request to that component.
Pair each trait with a regression test. Livewire makes this cheap:
Livewire::test(SearchPosts::class)
->set('term', 'laravel')
->assertSet('term', 'laravel')
->assertSee('...');
Write the test at the moment you adopt the trait, while you still know what "correct" means. With no dependents upstream, your test suite is the package's test suite.
Pin the version and review diffs on upgrade. Use "foxws/livewire-use": "1.0.*" rather than a floating constraint. Before bumping, run composer diff or open the changelog; with no community bug reports to lean on, a silent behavioral change in a boot hook is a real risk.
Vendor selectively if the surface is small. If src/ contains three useful traits and a dozen experimental ones, copying the useful ones into app/Support under MIT is often cheaper than carrying the dependency. This is especially true for traits that are purely internal helpers with no external coupling.
mount(), hydrate(), boot(), updated(), or updatedFoo() will conflict with identically named methods on your component. PHP raises a fatal error on trait-trait collisions but silently lets the component's own method win over a trait method — which means a trait's mount logic can vanish without warning. Grep for these before adopting.boot{TraitName} / initialize{TraitName} are the safe hooks. Livewire calls boot on every request including AJAX updates and mount only on the initial render. A trait that caches in mount but expects fresh state on subsequent updates will look broken in confusing ways. When debugging, log inside both and compare.dd() inside a trait kills the response. Livewire interactions are AJAX; dumping mid-request produces a broken payload and a silent no-op in the browser. Use logger(), ray(), or Telescope. If you must dump, wrap it in an if (app()->isLocal()) and inspect the network tab.updated() where relevant.#[Url(except: ...)] and keep filters that are user-identifying or sensitive out of the synced set.dd(__METHOD__) that your override is actually the one running.vendor:publish lists nothing for this package, don't go hunting for a config file — configuration is done by overriding methods or passing arguments, not by editing a published array.How can I help you explore Laravel packages today?