Download the PHP package iainheng/form without Composer

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

Important: This package is not actively maintained. For bug fixes and new features, please fork.

Form

This Project Has Been Deprecated. Code Climate Coverage Status

Boring name for a boring package. Builds form HTML with a fluent-ish, hopefully intuitive syntax.

Installation

You can install this package via Composer by running this command in your terminal in the root of your project:

Laravel

This package works great as a replacement Form Builder that was removed in Laravel 5. The API is different but all of the features are there.

If you are using Laravel 4 or 5, you can register the FormServiceProvider to automatically gain access to the Old Input and Error Message functionality.

To do so, just update the providers array in your config/app.php:

You can also choose to use the Facade by adding an alias in config/app.php:

Note that in Laravel 4, there is already a Form facade for the built-in Form Builder. If you want to use both, use a different alias. If you'd just like to use this one, remove the Form alias that points to the Illuminate component.

Basic Usage

Getting Started

First, instantiate a FormBuilder...

Next, use the FormBuilder to build an element. For example:

Opening a Form

Text and Password Fields

Text and password fields share the same interface.

Other available methods:

Textareas

Textareas share the same interface as regular text fields, with a couple of extra useful methods.

Checkboxes and Radio Buttons

Selects

Buttons

Hidden Inputs

Labels

Basic Label

Wrapping another element

Setting Attributes

Remembering Old Input

The FormBuilder can remember old input and prepopulate your form fields if you redirect back to the form because of a validation error.

To make this work, you must create a class that implements the OldInputInterface and pass it to the FormBuilder:

Now, your form elements will automatically populate with the user's old input data if it is available.

This works well with the defaultValue() methods, allowing you to set a default value that will be overridden by old input if the user has already submitted the form.

This package ships with a Laravel implementation out of the box, called IlluminateOldInput.

Error Messages

FormBuilder also allows you to easily retrieve error messages for your form elements. To do so, just implement the ErrorStoreInterface and pass it to the FormBuilder:

This package ships with a Laravel implementation out of the box, called IlluminateErrorStore.

You can also supply a format parameter to getError() to cleanup your markup. Instead of doing this:

...you can simply do this, which will display the formatted message if it exists, or nothing otherwise.

CSRF Protection

Assuming you set a CSRF token when instantiating the Formbuilder (or you are using Laravel), add a CSRF token to your form easily like so:

Data Binding

Sometimes you might have a form where all of the fields match properties on some sort of object or array in your system, and you want the user to be able to edit that data. Data binding makes this really easy by allowing you to bind an object or array to your form that will be used to automatically provide all of the default values for your fields.

This will work out of the box with Laravel's Eloquent models.

When using data binding, old input will still take priority over any of your bound values, so you can still easily redirect the user back to the form with any validation errors without losing any of the data they entered.

Note: Be sure to bind before creating any other form elements.


All versions of form with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.2
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 iainheng/form contains the following files

Loading the files please wait ....