Download the PHP package formr/formr without Composer

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

Formr

Latest Version on Packagist Total Downloads

Formr is a ridiculously fast and easy PHP form builder, with support for Bootstrap and Bulma right out of the box!

Find docs here: http://formr.github.io

If you find Formr useful, please consider starring the project and/or making a donation. Thank you!

Features

Installation

Composer

Run the following command to install Formr with Composer

Then include the autoload.php file and create a new form object.

Download

Download the .zip file and place the Formr folder in your project, then include the Formr class and create a new form object.

Bootstrap & Bulma Ready

Bootstrap and Bulma form classes are ready to go! Just tell Formr you want to use Bootstrap or Bulma when creating a new form and Formr will take care of the rest.

Basic Example

Simply enter your form labels as a comma delimited string and Formr will build the form, complete with opening and closing tags, a submit button, and email validation - plus all values retained upon POST. Easy!

Produces the following HTML

Basic Example with More Control

Using the create() method tells Formr you want control over adding the form tags and submit button yourself. Otherwise it's the same as the Basic Example above.

Produces the following HTML

Pre-Built Forms

Formr has several common forms already baked in, and it's really easy to create and save your own.

Produces the following HTML

Build Forms With Arrays

Produces the following HTML

Build Forms in HTML

You have full control over how you build your forms...

Produces the following HTML

Retrieving POST Values

It's super easy to retrieve your $_POST values and assign them to variables!

Validation

Formr can easly process and validate your forms

Like the create() method, we can pass a list of our form labels to the validate() method, which will get the $_POST values of our form fields and put them into an array. If your field name is email, a valid_email validation rule will be applied automatically!

Basic usage

Let's make sure the form was submitted, then we'll validate and get the value of our email field from the array.

Adding Rules

Let's make sure Name is a minimum of 2 characters and a maximum of 30 by adding our validation rules wrapped in parentheses.

Fine-Tune Your Validation

Of course you can get more in-depth with your validation, and even add custom error messaging! The following is a basic example, however Formr's validation methods are quite powerful and include, among other things, comparing values between fields and hashing using bcrypt()

Let's get the value of our email field using the post() method.

Now let's make sure it's a valid email address by entering the valid_email validation rule in the third parameter. If there's an error, the text entered into the second parameter will notify the user to correct the Email field.

We can take that a step further and enter a full custom error message in the second parameter to make our forms even more user-friendly.

Full Example


All versions of formr with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-mbstring Version *
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 formr/formr contains the following files

Loading the files please wait ....