همه چیز جدید در Livewire 4
Everything New in Livewire 4
Livewire 4 is a major release, and it's packed with features you're going to love. View-based components keep your PHP and Blade together in one file. Islands let you create isolated, independently-updating regions without the overhead of nested components. New directives like wire:sort tackle big things with minimal code. And a powerful JavaScript interceptor system gives you fine-grained control over every request.
Whether you're upgrading an existing app or starting fresh, this series will walk you through everything new, from the fundamentals to the advanced stuff. Let's dig in.
قسمتهای دوره
Getting Started (4)
به Livewire 4 خوش آمدید
3m 23sDiscover Livewire 4: tour its new features, learn the vision, and get set up to build reactive interfaces—perfect for upgrades or new projects.
کامپوننتهای مبتنی بر ویو
8m 43sCo-locate PHP and Blade in a single file with Livewire 4's view-based components, single or multi-file formats for easier discovery and maintenance.
کامپوننتهای صفحه
5m 41sBuild entire pages with Livewire using Route::livewire—manage layouts, page titles, and namespaces for organized, maintainable apps.
نصب Flux
3m 36sInstall Flux, Livewire's official UI library, to get beautiful form controls, cards, and layouts so you can build polished apps quickly.
Testing (3)
تست واحد
5m 29sLearn Livewire unit testing with Pest: test component state, trigger actions, and assert rendered output for reliable, maintainable apps.
تست مرورگر
5m 22sWrite Playwright-powered browser tests with Pest v4 and Livewire: run real browsers, click, type, and verify behavior as users experience it.
هممکانسازی تستها
4m 43sKeep tests next to components with Livewire's artisan commands—learn when co-located tests simplify organization and speed developer workflow.
Loading States (3)
حالتهای بارگذاری با data-loading
8m 54sUse Livewire 4's data-loading attribute with Tailwind variants to style loading states directly in markup—no wire:target or workarounds needed.
جایگذینهای بارگذاری تنبل
3m 22sUse Livewire's @placeholder directive to add skeleton loaders and spinners in component templates, keeping lazy-loading UI simple and concise.
بستهبندی درخواستهای تنبل
5m 37sCombine lazy Livewire requests with the bundle parameter to group deferred components into one network call - fewer requests, faster pages.
Composition (3)
ارسال ویژگیها
3m 7sForward HTML attributes in Livewire: pass classes and Alpine directives into components and apply them to inner elements for cleaner, reusable UI.
Master Livewire slots: pass Blade content into child components while preserving parent reactivity for cleaner, flexible component composition.
رابط کاربری خوشبینانه با wire:show
4m 14sBuild snappy, optimistic UIs with Livewire's wire:show and wire:text — toggle elements instantly client-side for faster, smoother user interactions.
Islands (5)
Learn Livewire 4 Islands to create isolated, independently updating regions for better performance without extra files, props, or events.
جزایر نامدار
4m 53sName your Islands to group and target updates with wire:island—learn naming strategies to control re-renders and sync components.
جزایر تنبل
4m 5sUse Lazy Islands to defer expensive parts until after page load—keep your page fast while slow components load when ready.
جزایر تو در تو
6m 40sMaster nested Islands to control component re-renders, use always:true for forced updates, and learn when nesting improves performance.
الحاق به جزایر
11m 34sLearn to append content with wire:island.append for infinite scroll, pagination, and real-time feeds—efficient updates without re-rendering lists.
Drag and Drop Sorting (1)
JavaScript (6)
ارجاعات عنصر با wire:ref
4m 15sName elements with wire:ref to target DOM or components, access $refs, dispatch events, and stream content to specific locations.
ردیابی وضعیت تغییر یافته
4m 50sUse $wire.$dirty() to detect unsaved changes in Livewire properties, show indicators, disable buttons, and provide instant UI feedback.
متدهای JSON
7m 20sMark actions with #[Json] to return JSON to Alpine or vanilla JS without re-rendering — fetch data and handle success or validation via promises.
اکشنهای جاوااسکریپت
3m 59sEasily run lightweight client-side code in Livewire using $js: define JS functions in your component and call them from wire directives.
رهگیرهای اکشن
9m 31sControl Livewire actions with $wire.intercept(): cancel requests, show loaders, save scroll, and run custom side effects before server calls.
رهگیرهای درخواست
7m 55sHook every Livewire request globally with interceptors — handle session expiration, custom redirects, logging, and automatic error recovery.




