An elegant, zero-configuration security package for Laravel Livewire 4 that automatically locks all public component properties from client-side manipulation, unless explicitly marked as unlocked.
✅ Auto-lock properties
✅ Zero configuration
✅ Protects against client-side tampering
✅ Unlock specific properties with #[Unlocked]
✅ Supports Livewire 4 (Single & Multiple File)
💝 Support me by the only available way now: USDT to buy a new dev laptop. Info is below, or contact me by 📩 email: janecodelife@gmail.com
- Livewire ^4.0
You can install the package via composer:
composer require janecodelife/livewire-secure-propertiesIf you are using Livewire 4's native Single File Components layout, you can safely use the #[Unlocked] attribute inside the anonymous class block:
<?php
use Livewire\Component;
use JaneCodeLife\LivewireSecureProperties\Unlocked;
new class extends Component {
// ✅ Secured: Locked by default, any client-side update will throw a Security Violation exception
public string $role = 'admin';
// 🔓 UNLOCKED: Updatable from client side via wire:model or client-side requests
#[Unlocked]
public string $name = 'Jane Joe';
};
?>
<div>
<input type="text" wire:model.live="name">
<p>Name: {{ $name }}</p>
<!-- This would securely block any client-side update attempts -->
<input type="text" wire:model.live="role">
<p>Role: {{ $role }}</p>
</div>use Livewire\Component;
use JaneCodeLife\LivewireSecureProperties\Unlocked;
class UserProfile extends Component
{
// ✅ Secured: Locked by default, any client-side update will throw a Security Violation exception
public string $role = 'admin';
// 🔓 UNLOCKED: Updatable from client side via wire:model or client-side requests
#[Unlocked]
public string $name = 'Jane Joe';
public function render()
{
return view('livewire.user-profile');
}
}If you need to disable the package globally during specific environments (e.g., local debugging), you can add this environment variable to your .env file:
LIVEWIRE_SECURE_PROPERTIES_ENABLED=falseWhen a locked property is violated, the package throws a PropertyLockedException with a 403 status code, making it easy to intercept globally or monitor via your error loggers.
This plugin is built entirely on developer insights gathered over years of building real-world software to catch common pain points, combined with months of dedicated building and rigorous testing to ensure it operates flawlessly.
If this utility boosts your everyday speed and eliminates annoying file search clutter, please consider buying me a coffee or supporting my continuous maintenance!
You can tip or donate directly to my TRON (TRX / USDT-TRC20) crypto wallet address:
- Network:
TRX Tron (TRC20) - Address:
TAFFjBP39Z86weL5dDU1A2251VrgPprDUj
Every bit of support fuels the expansion of this ecosystem and helps me write cleaner tools for all of us. Thank you for standing behind independent developers! 🙏
Check out my other open-source tools to supercharge your Neovim environment:
- livewire-secure-properties - Secure livewire app properties by default and void headache.
- todo-tracker.nvim - Assign and list app todos in a blink
- folders-bookmark.nvim - Bookmark folders and accessing them by keymap in a blink
- copy-history.nvim - Access your copy (Yank) history and paste it again by 1 click in a blink.
- rest-client.nvim - run http request from anywhere in a blink
I will be there i am answer to all messages
- X (Twitter): https://x.com/janecodelife
- YouTube: https://www.youtube.com/@JaneCodeLife
- Email: janecodelife@gmail.com
A huge thank you to our sponsors!
I am currently cooking a comprehensive guide and boilerplate configuration on How to turn Neovim into a (Powerful) IDE explicitly optimized for:
- Backend & Frameworks: PHP (Intelephense) & Full Laravel & Livewire Integration (With Preformance)
- Frontend & Tooling: HTML, CSS, JavaScript, TypeScript, and Livewire SFCs
- Speed: Blazing fast autocompletion, lightning-speed code navigation, and fuzzy finding.
