Download the PHP package jazzman/form-html-generator without Composer

On this page you can find all versions of the php package jazzman/form-html-generator. 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-html-generator

FormManager

Usage

Namespace import

FormManager is namespaced, but you only need to import a single class into your context:

Create a field

All HTML5 field types are supported.

Generate the html code

The html code is created automatically on convert the object into a string:

Working with data

Inputs can validate the data depending of the type and other validation attributes:

The inputs can handle custom validators:

The load() method is like val() but it handles the data sent by the client:

Labels

You can use labels with your inputs, just use the property ->label and it will be created automatically. It may also generate an extra label with the error message.

Datalist

Datalist are also allowed, just use the datalist() method to set/get values:

Custom renders

You can configure how each field must be rendered. First, you need to know all properties of each field:

Special fields

In addition with regular fields (the html5 equivalents: text, textarea, select, datetime, etc...) there are some special fields useful to create more complicate data schemes:

Group

A group is a simple field to store other fields under a name. The following example shows a group of three fields:

Choose

This field stores other fields with the same name but different values. Useful for radio inputs or to define various submit buttons.

Collection

It's like a group, but stores a collection of values:

CollectionMultiple

If you need different types of values in your collection, CollectionMultiple is the answer:

Loader

The main aim of the loader field is to separate the way to load the data with the way to store and keep this data once it's loaded. Let's say for example, an input type file: if a file is loaded, the value is an array with the same structure than any $_FILES value, but if user doesn't upload anything, the value is empty. So, what is supposed to do in this case? remove the file or keep the previous value? The loader field has two fields: a "loader" field and a "field" field. The first one is responsive to load the new values (for example, it can be an input type file) and the second keeps the previous value (for example, it can be an input type hidden, or text, etc). Let's see an example:

Forms

We need a form to put all this things together. The form is just another field, in fact, it's like a Group.

Builder

The Builder class is used to ease the creation of fields and containers. For example, instead of this:

You can do simply this:

The FormManager\Builder handles the instantation of all theses classes for you using factories. By default, it contains the FormManager\Factory, responsible of instantation of all fields and containers.

But you can add your owns factories, creating classes implementing FormManager\FactoryInterface.

This is useful for a lot of things. For example, to create custom fields:

Use it in your app:

Other usage is to save all forms of your app under a namespace:

And create a factory

Use it:

Note: Each time you register a new factory, it will be prepended to the already registered ones, so if you register fields/containers called "Form", "Textarea", etc, they will be used instead the default. This allows extend them.

Builder instances

The static builder is fine for most cases, but sometimes you need to combine differents builders with different factories. So you can create instances:


All versions of form-html-generator with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
psr/http-message Version ~1.0
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 jazzman/form-html-generator contains the following files

Loading the files please wait ....