packagist livewire/livewire v0.6.0

latest releases: dev-main, dev-add-listener-removal, dev-add-security-docs...
3 years ago

Upgrade Guide:

Convert @livewireAssets to @livewireStyles/@livewireScripts







Change references to changed Livewire exceptions:

// Before
} catch (Livewire\Exceptions\ProtectedPropertyBindingException $e) {
} catch (Livewire\Exceptions\MissingComponentMethodReferencedByAction $e) {

// After
} catch (Livewire\Exceptions\PublicPropertyNotFoundException $e) {
} catch (Livewire\Exceptions\MethodNotFoundException $e) {

Change Notes:


  • Auto-pass public properties to render method's blade view again (no need to reference $this->foo if $foo is a public component property.)
  • Can dynamically register listeners using the new protected function getListeners() method, instead of hardcoding listeners into the protected $listeners property.
  • Added $this->dispatchBrowserEvent('foo') component method to instruct the root dom node of a component to dispatch a custom JS event in the browser. Useful for communicating with JS code like AlpineJS.
  • Added ->assertDispatchedBrowserEvent('event', $data) for asserting that a Livewire component dispatched a browser event.
  • Added $this->addError('key', 'message') method to the component class for adding bespoke error keys and message to the component's error bag. Useful for manually triggering a validation-like error response in the view.
  • Added @livewireStyles and @livewireAssets directives to separate out the styles and the scripts. This allows users to register styles separately in the <head>, but scripts at the bottom of the <body> tag. This arrangement is the new official recommendation (for other JS-related reasons (like registering custom directives)), and the current @livewireAssets directive will likely be removed in the next major version release (1.0)
  • Allow passing component classes directly into the @livewire directive: @livewire(App\Http\Livewire\Counter::class), instead of relying on the alias: @livewire('counter') (#506)
  • Added actingAs($user) method to the testing utility for convenience: Livewire::actingAs($user)->test('counter')...
  • Added $this->assertSeeLivewire('counter') TestResponse macro, to easily test weather a Livewire component is loaded in the plain Laravel testing response.
  • Allow optional second parameter for livewire route macro: Route::livewire('foo' ,'foo') -> Route::livewire('foo'). Useful when the route and the component name are the exact same.
  • Add ->assertRedirect('/path') testing helper (#503)
  • Auto-disabled Livewire forms on submit: set buttons to disabled and inputs to readOnly
  • Add custom directives API: window.livewire.directive('foo', (el, directive, component) => {}) to register third-party directives.
  • Can now set element.__livewire_ignore property on a DOM element, and Livewire's DOM-differ will ignore changes on this element. (It behaves exactly like wire:ignore, but can be programatically set)
  • Support system modifier key combos: ['ctrl', 'shift', 'alt', 'meta', 'cmd', 'super'] for registering listeners like: wire:keydown.cmd.shift.k (#512)


  • Renamed ProtectedPropertyBindingException -> PublicPropertyNotFoundException (with better messaging)
  • Renamed MissingComponentMethodReferencedByAction -> MethodNotFoundException (with better messaging)


  • Removed the ->assertCacheHas() testing helper, as it hasn't worked since the Livewire caching API was removed.


  • Vapor wasn't working well with Livewire when assets were published (#524)
  • Fix another Vapor condition (#521)
  • Added better error messaging surrounding DOM-diffing issues
  • Fixed a bug where dynamically changing components with shared element "id"s caused a morphdom breakage.

Don't miss a new livewire release

NewReleases is sending notifications on new releases.