PHP code example of batistackapp / progress-stepper
1. Go to this page and download the library: Download batistackapp/progress-stepper library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
->options(array | Closure $options) // ['value' => 'Label', …]
->optionsFromEnum(string $enumClass) // derive from a BackedEnum
enum OrderStatus: string implements HasLabel, HasColor, HasIcon
{
case Draft = 'draft';
case Sent = 'sent';
case Confirmed = 'confirmed';
case Done = 'done';
public function getLabel(): ?string
{
return match ($this) {
self::Draft => __('orders.state.draft'),
self::Sent => __('orders.state.sent'),
self::Confirmed => __('orders.state.confirmed'),
self::Done => __('orders.state.done'),
};
}
public function getColor(): string | array | null
{
return match ($this) {
self::Draft => 'gray',
self::Sent => 'info',
self::Confirmed => 'primary',
self::Done => 'success',
};
}
public function getIcon(): ?string
{
return match ($this) {
self::Draft => 'heroicon-m-document',
self::Sent => 'heroicon-m-paper-airplane',
self::Confirmed => 'heroicon-m-check-badge',
self::Done => 'heroicon-m-check-circle',
};
}
}
ProgressStepper::make('state')->optionsFromEnum(OrderStatus::class);
->markCompletedUpToCurrent(bool | Closure $condition = true)
// Steps ordered before the current one take the completedColor. Default: false.
->errorStates(array | Closure $states)
// Values that should render with errorColor. e.g. ['cancelled', 'rejected'].
->hideStatesFor(Closure $callback)
// Callback returns an array of values to hide. Receives ['record' => …] if
// used inside a resource form/infolist — see the real-world example below.
->icons([ // available on both components
'draft' => 'heroicon-m-document',
'sent' => 'heroicon-m-paper-airplane',
'confirmed' => 'heroicon-m-check-badge',
'done' => 'heroicon-m-check-circle',
])
use Webkul\ProgressStepper\Enums\ConnectorShape;
use Webkul\ProgressStepper\Enums\Direction;
use Webkul\ProgressStepper\Enums\Size;
use Webkul\ProgressStepper\Enums\Theme;
use Webkul\ProgressStepper\Forms\Components\ProgressStepper;
ProgressStepper::make('state')
->options([...])
->size(Size::Large)
->direction(Direction::Horizontal)
->theme(Theme::Outlined)
->connectorShape(ConnectorShape::Chevron);