Download the PHP package idkwhoami/flux-wizards without Composer
On this page you can find all versions of the php package idkwhoami/flux-wizards. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download idkwhoami/flux-wizards
More information about idkwhoami/flux-wizards
Files in idkwhoami/flux-wizards
Package flux-wizards
Short Description This package provides a reusable, configurable wizard livewire component styled using Flux
License MIT
Homepage https://github.com/idkwhoami/flux-wizards
Informations about the package flux-wizards
Flux Wizards
A Laravel package that provides functionality for building wizard-style multi-step forms with Livewire Flux.
Table of Contents
- Features
- Installation
- Requirements
- Usage
- Quick Start
- Creating a Wizard
- Required Methods
- Navigation Methods
- Creating Step Views
- Blade Directives
- Customizing the Wizard View
- Localization
- API Reference
- Wizard Class
- Step Class
- License
Features
- Object-oriented API for defining wizard steps and their relationships
- Navigation between steps with next() and previous() methods
- Custom flow logic for determining step progression
- Validation rules for each step
- Blade directives for conditional step rendering
- Livewire integration with the HasWizard trait
- Designed for use with Livewire Flux
Installation
You can install the package via composer:
The package will automatically register its service provider.
Requirements
- PHP 8.3+
- Laravel 11+
- Livewire Flux 2.1+
- Livewire Flux Pro 2.1+
Usage
Quick Start
To quickly implement a wizard in your Livewire component:
- Add the
HasWizard
trait to your Livewire component - Implement the required
createWizard()
andcomplete()
methods - Create views for each step in your wizard
- Use the navigation methods
nextStep()
andpreviousStep()
for moving between steps
Creating a Wizard
To create a wizard, use the HasWizard
trait in your Livewire component and implement the required methods:
Required Methods
When using the HasWizard
trait, you must implement the following methods:
createWizard()
: Returns a configured Wizard instance with steps.complete(array $data)
: Handles the final submission when all steps are completed.
Navigation Methods
The HasWizard
trait provides two methods for navigating between steps:
nextStep()
: Move to the next step in the sequence or complete the wizard if on the last step.previousStep()
: Move to the previous step in the sequence.
Creating Step Views
Create Blade views for each step in your wizard. The views should be placed in the directory specified in the directory()
method of your Wizard:
Blade Directives
The package provides two Blade directives for conditional rendering based on the current step:
@step('step-key')
: Renders content only if the current step matches the specified key.@endstep
: Closes the conditional block.
Example:
Customizing the Wizard View
The package comes with a default wizard view that includes navigation buttons and error handling. You can publish this view to customize it:
Localization
The package includes translations for navigation buttons. You can publish the language files to customize them:
API Reference
Wizard Class
The Wizard
class is the main container for your wizard:
make(string $name)
: Create a new wizard instanceroot(Step $root)
: Set the root step of the wizarddirectory(string $directory)
: Set the directory where step views are storednext()
: Move to the next stepprevious()
: Move to the previous stepgetCurrent()
: Get the current stepsetData(array $data)
: Set data for the wizardgetData()
: Get all data from the wizard
Step Class
The Step
class represents a single step in your wizard:
make(string $name)
: Create a new step instancelabel(string $label)
: Set a human-readable label for the stepview(string $view)
: Set a custom view name (defaults to the step name)rules(array $rules)
: Set validation rules for the stepchildren(array $children)
: Set child stepsflow(Closure $flow)
: Set custom flow logicis(string $name)
: Check if the step has a specific nameisFirst()
: Check if the step is the first in the sequenceisLast()
: Check if the step is the last in the sequencevalidate(array $data)
: Validate the step dataresolveNext(array $data)
: Resolve the next step based on flow logic
License
The MIT License (MIT). Please see License File for more information.