Laravel Livewire Snippets
⚠️ Disclaimer ⚠️
This is not the official Visual Studio Code extension. This is a community-created extension that provides snippets for Laravel Livewire development.
Features
This extension provides snippets for both PHP and Blade files to help you write Livewire code faster.
PHP Snippets
Prefix |
Description |
lwclass |
Create a new Livewire component class |
lwprop |
Create a public Livewire property |
lwmethod |
Create a Livewire method |
lwmount |
Create a Livewire mount method |
lwupdated |
Create a Livewire property update handler |
lwrules |
Define Livewire validation rules |
lwmessages |
Define Livewire validation messages |
lwcomputed |
Create a Livewire computed property |
lwevent |
Create a Livewire event listener |
lwquery |
Define Livewire query string parameters |
lwhydrate |
Create a Livewire hydration hook |
lwdehydrate |
Create a Livewire dehydrate hook |
lwboot |
Create a Livewire boot method |
lwbooted |
Create a Livewire booted method |
lwvalidate |
Create a Livewire method with validation |
lwvalidatemessages |
Create a Livewire method with validation and custom messages |
lwreset |
Create a Livewire reset method for a property |
lwresetall |
Create a Livewire reset method for all properties |
lwpaginate |
Create a Livewire computed property with pagination |
lwsearch |
Create a Livewire search functionality with pagination |
lwsort |
Create a Livewire sorting functionality |
lwupload |
Create a Livewire file upload functionality |
lwflash |
Create a Livewire flash message |
lwredirect |
Create a Livewire redirect |
lwemit |
Emit a Livewire event |
lwemitTo |
Emit a Livewire event to a specific component |
lwemitUp |
Emit a Livewire event up to parent components |
lwdispatch |
Dispatch a browser event from Livewire |
Blade Snippets
Prefix |
Description |
lwcomp |
Include a Livewire component |
lwscripts |
Include Livewire scripts |
lwstyles |
Include Livewire styles |
lwform |
Create a Livewire form |
lwinput |
Create a Livewire input field |
lwtextarea |
Create a Livewire textarea |
lwselect |
Create a Livewire select field |
lwcheckbox |
Create a Livewire checkbox |
lwradio |
Create a Livewire radio button |
lwloading |
Show loading state |
lwloadingtarget |
Show loading state for specific target |
lwerror |
Display validation error message |
lwpoll |
Add polling to a component |
lwclick |
Add click event handler |
lwkeydown |
Add keydown event handler |
lwfile |
Create a Livewire file upload input |
lwpagination |
Add Livewire pagination links |
lwsearchinput |
Create a Livewire search input with debounce |
lwsortheader |
Create a sortable table header for Livewire |
lwflashmessage |
Display a Livewire flash message |
lwmodal |
Create a Livewire modal with Alpine.js |
lwconfirm |
Create a Livewire confirmation dialog with Alpine.js |
lwspinner |
Create a Livewire loading spinner |
lwerrorbag |
Display all Livewire validation errors |
lwalpine |
Create a Livewire component with Alpine.js integration |
lwpollinterval |
Add Livewire polling with custom interval and keep-alive |
lwlazy |
Create a lazy-loaded Livewire component |
lwdefer |
Create a deferred loading Livewire component |
lwoffline |
Show offline state in Livewire component |
lwdirty |
Show dirty state in Livewire component |
Usage
- Type the prefix of the snippet you want to use
- Press
Tab or Enter to insert the snippet
- Use
Tab to navigate through the placeholders
Requirements
- Visual Studio Code 1.60.0 or higher
- PHP Language Support extension (recommended)
- Laravel Blade Snippets extension (recommended)
Extension Settings
This extension contributes the following settings:
- No additional settings required
Known Issues
- No known issues at the moment
Release Notes
1.0.0
Initial release of Laravel Livewire Snippets with:
- PHP snippets for Livewire components
- Basic component structure
- Properties and methods
- Lifecycle hooks
- Validation
- Events
- File uploads
- Pagination and sorting
- Search functionality
- Blade snippets for Livewire templates
- Component inclusion
- Forms and inputs
- Loading states
- Error handling
- Alpine.js integration
- Modals and dialogs
- Lazy loading
- State management
- Comprehensive documentation
- MIT License
Contributing
We welcome your feedback and suggestions to improve these snippets.
License
This project is licensed under the MIT License - see the LICENSE file for details.
| |