Form wizard can be challenging and may require a higher effort to complete them. Gargantua is a minimalist form wizard library.
Before you install, it is important to check that your PHP version at least PHP 7.1+
.
composer require azmanabdlh/gargantua
Read the example test to get started.
use Gargantua\Contract\Session;
use Gargantua\Contract\Page;
use Gargantua\Contract\Request;
public static function provide(
Page[] $page,
Session $session,
): Form
// get current page utils.
public function page(): PageUtils
// check form page can be navigate back.
public function canBack(): bool
// check form page is last.
public function last(): bool
Page provide a form page
// provide form page name.
public function pageName(): string
// when form page submitted try to invoke func.
public function onSubmit(Request $request): void
// try to move the next page can invoke func.
public function onNext(array $payload): void
// when it reaches the tail, each form page invoke func.
public function onCompleted(): void
use Gargantua\Contract\CanNavigateBack;
// try back to the prev page can invoke func.
public function onNavigateBack(): void
PageUtils provide Page utilities
// validate page is active.
public function is(string $pageName): bool
// get page label.
public function label(): string
// get page icon.
public function icon(): string
// example
public function icon(): string {
return "<img .../>"; // or <i icon="user-account"></i>
}
// get current page number.
public function number(): int
Intercept form page using Cable for each Page submitted.
$form->capture([
new VerifyJwtToken()
]);
// handle logic.
function handle(Request $request): void
Licensed under MIT. Totally free for private or commercial projects, or any other uses.