Download the PHP package delboy1978uk/form without Composer

On this page you can find all versions of the php package delboy1978uk/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

form

Latest Stable Version Total Downloads Latest Unstable Version License
build status Code Coverage Scrutinizer Code Quality
A super easy Bootstrap ready HTML form generator for PHP

An example generated form

v2.0.0 has been upgraded for PHP 7.1+ and now has 'Field Transformer' functionality. You can add data transformers to fields to have them convert objects into form data, and vice versa. See the Transformers section of this readme.

Installation

Install via composer

Usage

Firstly, "use" all the classes you'll need for your form. Then create your form and fields.

Creating Custom Forms

Of course, it's nicer to create your own form than build one up every time, so just create a class and extend Del\Form\AbstractForm and add your fields in the init() function:

Then using your form is as simple as:

Fitering and validating input

For filtering input, add a Del\Form\Filter\Interface to your field object. For validating the filtered input, add a Del\Form\Validator\ValidatorInterface. Currently there is an adapter for Laminas\Filter and Laminas\Validate, but feel free to write an adapter for you favourite library. Setting a required field adds a Del\Form\Validator\NotEmpty validator.

Setting and getting values

Del\Form\FormInterface has a populate method which takes an array (usually the post data, but not necessarily ;-).

After populate has been called, if you call Form::render(), it will display any validation error messages.

Field Types

Text

Del\Form\Field\Text fields are the most basic field, and come with a built in StripTags and StringTrim filter.

Del\Form\Field\Text\EmailAddress extends Text, and adds an EmailAddress validator for convenience.

Del\Form\Field\Text\Password is a password field which also extends Text.

TextArea

Del\Form\Field\TextArea fields are pretty much the same as the Text field

Select

Del\Form\Field\Select needs initialised with setOptions():

MultiSelect

Del\Form\Field\MultiSelect also needs initialised with setOptions(), and works in the same way as a Select field.

Radio

Del\Form|Field\Radio can be rendered inline (side by side) or not, also needs initialised with setOptions():

Checkbox

Del\Form|Field\Checkbox can be rendered inline or not, also needs initialised with setOptions():

FileUpload

Del\Form\Field\FileUpload fields come with a nifty looking Bootstrap compatible renderer, but it uses some javascript. If you don't want that, just call setRenderer() and pass it a default TextRender class instance. Also, don't forget to set the encryption type on the form to Form::ENC_TYPE_MULTIPART_FORM_DATA

Submit`

Del\Form|Field\Submit doesn't really need much:

Dynamic Forms

You can have for example a radio button with two choices, and each choice can have a separate form relevant to the checked value. For instance, a radio with a choice of food or drink could then display a dynamic form upon clicking the drink option, and the drinks form will display.

An example generated form

Transformers

You can create an object implementing De\Form\Field\TransformerInterface to take in input and convert to a form value. Do the opposite in the output method and return the object representation. Bone MVC comes with one built in Transformer for DateTime fields:

Now the array you populate the form with can contain either the string or the DateTime representation. When getting the values from the form, you pass true to use the transformers:


All versions of form with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-dom Version *
ext-fileinfo Version *
laminas/laminas-validator Version ^2.52
laminas/laminas-filter Version ^2.34
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 delboy1978uk/form contains the following files

Loading the files please wait ....