tomeasterbrook / livewire-fakeable
Fill your Livewire component state with realistic fake data during local development.
Fund package maintenance!
Requires
- php: ^8.1
- illuminate/contracts: ^10.0|^11.0|^12.0|^13.0
- livewire/livewire: ^4.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.8
- orchestra/testbench: ^10.0.0||^9.0.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- spatie/laravel-ray: ^1.35
This package is auto-updated.
Last update: 2026-04-26 09:53:06 UTC
README
Livewire 4. Fill empty component state with Faker while you build — after
mount, only on your machine, never overwriting values you already set.
Livewire Fakeable is a focused Laravel package with a simple idea: declare fake data next to your Livewire properties, and let a component hook apply it when it is safe. No seeding scripts scattered across mount() methods, and no guessing whether you are looking at real or dummy data.
Installation
composer require tomeasterbrook/livewire-fakeable
The service provider is discovered automatically. Publish the config if you want to change locale, hosts, or the on-page indicator:
php artisan vendor:publish --tag="livewire-fakeable-config"
Quick start
Annotate public properties with #[Fakeable] and a Faker formatter name. Empty properties are filled after mount — only in local dev, never overwriting values you already set.
use Livewire\Component; use TomEasterbrook\LivewireFakeable\Attributes\Fakeable; class EditProfilePage extends Component { #[Fakeable('name')] public string $name = ''; #[Fakeable('safeEmail')] public string $email = ''; #[Fakeable('paragraph')] public string $bio = ''; }
Use #[Fakeable] without a formatter to infer one automatically from the property name, type, or enum.
See the full documentation for array shapes, state classes, Form objects, seeds, locale, and more.
Safety
Faking only runs when all of these are true — otherwise the package does nothing:
enabledistruein config- App environment is
local - Request host matches an
allowed_hostsglob (e.g.*.test) Faker\Generatoris available
Testing
composer test
Changelog
Please see CHANGELOG.
Contributing
Please see CONTRIBUTING.
Security
Please see our security policy.
Credits
License
Livewire Fakeable is open-sourced software licensed under the MIT license.
