Download the PHP package tuum/form without Composer

On this page you can find all versions of the php package tuum/form. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package form

Tuum/Form

Scrutinizer Code Quality Build Status

Helper classes for escaping input values, generating HTML tags, and managing data.

Licence

MIT Licence

PSR

PSR-1, PSR-2, and PSR-4.

Getting Started

Installation

Sample Code

There are many helpers, and some are related. It would be easier to use DataView object to manage helpers. For instance,

The DataView object injects Inputs object into Forms helper so that it can generate HTML tags using old input values (i.e. old-name) instead of given value (default).

List of Helpers

These helpers help to manage data to be viewed in a template. There are,

Escape Helper

The Escape class manages the escaping string to securely display text in a certain content, such as HTML.

Escaping for Html

As a default, strings will be escaped using Escape::htmlSafe($string) method (which internally uses htmlspecialchars function for HTML files). There are some other way to escape.

Using Other Escape Method

You can specify another escape method at the construction or using withEscape method:

The escape method must be a callable; either a function name, or a closure with string as an argument.

Using Escape with DataView

The DataView object contains an Escape object to be shared with other helpers, such as Data and Inputs.

Specify the escape at the construction.

Data Helper

Use class to display strings and values to template while escaping the values.

to access data, any of the following works.

Iterating Over Array

the Data object implements IteratorAggregate interface.

only works for an array. so do not do this...

Extract by Key

Use extractKey method to create a subset of object if the data is an array of another array (or object).

Hidden Tag

There is a simple method to show a hidden tag:

Inputs Helper

Use Inputs class to convenient access array of data using HTML form element names.

selected and checked methods

There is selected and checked methods to simplify checking some form elements.

Errors Helper

The Errors manages error messages associated with input values, which works just like Inputs class except that this class has a method, p which outputs the error message in a pre-defined format.

Message Format

To change the format of the error message, just do:

Message Helper

This helper may not be that generic. Message class is for general message to be displayed in a main contents of a web page.

The method shows only one first message that is most severe.

Message Format

There are 3 formats for each severity of messages. Alter the format as necessary.

Forms Helper

The Forms helper class generates various HTML form tags.

using with Inputs object

Inject Inputs object into Forms object to use it when generating HTML tags.

escaping for HTML

The Forms class does not escape its property nor values. It assumes that the values are given by the programmer. So, use Data helper when displaying user's input.

Input Elements

Creates various form input element. The most generic method is input.

will generate

Already various methods exists for html's input tags, such as: text, hidden, email, password, radio, and checkbox.

The extra html attribute can be added by method as follows.

There are many shortcut methods defined in Forms object, such as text, hidden, datetime, etc. All these shortcuts has the same signature:

Open/Close Forms

To start and close a form;

if a non-standard method is given, it will generate a hidden tag with the method in the open() method. The default name is _method which can be altered by the second argument to method, as;

Label

can output label as;

Buttons

currently, two buttons are supported.

TextArea

text-area is supported.

Select List

it's easy to create a select box.

The first argument being name of the element, second is the index of options, and 3rd is the selected item.

Checkbox and Radio List

Often you want to generate a list of checkbox or radio buttons. You can build it a bit like a select box.

will output the list of checkboxes inside ul > li surrounded with label;

You can construct the HTML using own code.

Dates Helper

The Dates helper class aims to help construct a complex form elements, such as date (which have year, month, and day form elements). For instance,

will generate html for years between 2014 and 2016;

Using List for Year, Month, and Day

When constructing a date with year list, it generates ranging from last year till next year as a default. You can change this by using setYear method.

There are set* methods for Year, Month, Day, Hour, Minute, and Second. Each method expects to get ListInterface, Traversable object, or an array. There are also List objects for each type with specific method to displayed in various format.

will generate some HTML like,


All versions of form with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tuum/form contains the following files

Loading the files please wait ....