azmanabdlh / gargantua
Minimalist form wizard library.
1.0.0
2024-07-23 05:29 UTC
Requires
- php: ^8.1
- symfony/http-foundation: ^7.1
Requires (Dev)
- mockery/mockery: ^1.6
- pestphp/pest: ^2.34
This package is auto-updated.
Last update: 2025-06-23 15:38:07 UTC
README
Form wizard can be challenging and may require a higher effort to complete them. Gargantua is a minimalist form wizard library.
Table of Content
Installation
Before you install, it is important to check that your PHP version at least PHP 7.1+
.
composer require azmanabdlh/gargantua
Quick Start
Read the example test to get started.
API
Form
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
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
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
Cable
Intercept form page using Cable for each Page submitted.
$form->capture([ new VerifyJwtToken() ]); // handle logic. function handle(Request $request): void
License
Licensed under MIT. Totally free for private or commercial projects, or any other uses.