2017 © Pedro Peláez
 

library formz

A Simple Stand-alone PHP Form Helper

image

thybag/formz

A Simple Stand-alone PHP Form Helper

  • Tuesday, April 8, 2014
  • by bag
  • Repository
  • 1 Watchers
  • 1 Stars
  • 1,120 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

FormZ

A Simple Stand-alone PHP Form Helper, (*1)

Installtion

FormZ can be installed via composer using:, (*2)

composer require thybag/formz:dev-master

Once composer has installed the library, simply include the standard composer autoloader in to your code., (*3)

require 'vendor/autoload.php'

Usage Examples

// Make Form refers to formz/Form
use formz\Form;

//Open form
Form::open("/somthing")->attributes(array("class"=>"test"))->render(true);

// Create a required text field with default value of "bob"**
Form::text("name")
    ->attributes(array('required'=>'required'))
    ->defaultValue("Bob")
    ->render(true);

// Select box with list of cows, css class cow_selector 
// and default selection of Dexter**
Form::select("cow")
    ->options(array(
        'A' => 'Angus',
        'D' => 'Dexter',
        'J' => 'Jersey',
        'H' => 'Holstein'
    ))
    ->attributes(array('class'=> 'cow_selector'))
    ->defaultValue('D')
    ->render(true);

Form::close()->render(true);

You can have the form automatically populated from post data by calling the following before the form methods, (*4)

Form::populate($_POST);

The Versions

08/04 2014

dev-master

9999999-dev

A Simple Stand-alone PHP Form Helper

  Sources   Download

by Carl Saggs