### Install laravel-livewire-wizard with Composer Source: https://github.com/jeffersongoncalves/laravel-livewire-wizard/blob/main/README.md Install the package via Composer. Requires PHP 8.2+, Laravel 11/12/13, and Livewire 3. ```bash composer require jeffersongoncalves/laravel-livewire-wizard ``` -------------------------------- ### Create a wizard component extending WizardComponent Source: https://github.com/jeffersongoncalves/laravel-livewire-wizard/blob/main/README.md Define a wizard component by extending WizardComponent and returning an array of step component classes in the steps() method. ```php namespace App\Livewire; use JeffersonGoncalves\LivewireWizard\Components\WizardComponent; class CheckoutWizardComponent extends WizardComponent { public function steps(): array { return [ CartStepComponent::class, DeliveryAddressStepComponent::class, ConfirmOrderStepComponent::class, ]; } } ``` -------------------------------- ### Run tests with Composer Source: https://github.com/jeffersongoncalves/laravel-livewire-wizard/blob/main/README.md Run the package's test suite. ```bash composer test ``` -------------------------------- ### Create a step component extending StepComponent Source: https://github.com/jeffersongoncalves/laravel-livewire-wizard/blob/main/README.md Create a step component by extending StepComponent. Each step is a regular Livewire component that renders its own view. ```php namespace App\Livewire; use JeffersonGoncalves\LivewireWizard\Components\StepComponent; class CartStepComponent extends StepComponent { public function render() { return view('checkout-wizard.steps.cart'); } } ``` -------------------------------- ### Register wizard and step components with Livewire Source: https://github.com/jeffersongoncalves/laravel-livewire-wizard/blob/main/README.md Register the wizard and step components with Livewire so they can be used in Blade templates. ```php use Livewire\Livewire; Livewire::component('checkout-wizard', CheckoutWizardComponent::class); Livewire::component('cart-step', CartStepComponent::class); Livewire::component('delivery-address-step', DeliveryAddressStepComponent::class); Livewire::component('confirm-order-step', ConfirmOrderStepComponent::class); ``` -------------------------------- ### Navigate steps from a step component Source: https://github.com/jeffersongoncalves/laravel-livewire-wizard/blob/main/README.md Navigate between steps from inside any step component by calling nextStep() or previousStep(). ```php $this->nextStep(); $this->previousStep(); ``` -------------------------------- ### Navigate steps from a Blade view Source: https://github.com/jeffersongoncalves/laravel-livewire-wizard/blob/main/README.md Navigate between steps directly in a view using wire:click to trigger previousStep or nextStep. ```blade