PHP code example of azmanabdlh / gargantua

1. Go to this page and download the library: Download azmanabdlh/gargantua 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/ */

    

azmanabdlh / gargantua example snippets


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

// 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

// 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


$form->capture([
  new VerifyJwtToken()
]);


// handle logic.
function handle(Request $request): void