checkk/html-builder

There is no license information available for the latest version (dev-master) of this package.

Easy way to build html elements

dev-master 2021-02-11 09:42 UTC

This package is auto-updated.

Last update: 2024-10-11 18:17:11 UTC


README

  • PHP 7.0 or above

Installation

To use this lib

composer require checkk/html-builder

Usage

  • Create empty form
$form = new Form('action.php');
  • Add name or id attribute to form
$form->addAttribute('name', 'my_best_form');
$form->addAttribute('id', 'form_id');
  • Add inputs to form
$form->addInput('text', 'login');
$form->addHiddenInput('csrf', 'qrqrqwreqaf');
$form->addSubmitInput('Push me');
  • Add script after form.
$form->addScript("window.onload = function () {document.forms[0].submit();}");
  • Good for payment form submitting