Download the PHP package moon250/form-generator without Composer

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

FormGenerator

Build Status Coverage Status

FormGenerator is a class that generates forms in a very simple way.

Table of contents

Installation

You can use composer for install this package.

Basic Usage

Start by instancing the FormGenerator class.

Next, you can use this object to add some fields with the "add" method. This method took 2 parameters, one is the name, and the second parameter is for define the type. This parameter is optionnaly. The default type is text.

To generate the form, use the "generate" method

Types

By default, the type is "text". You can change this by pass another parameter in the "add" method.

If the name of your field ends with "_at", the type of this field will be "date".

If the name specified is a valid type and no type was specified in parameters, the name will be used in type.

Options

In the third parameter of the "add" method, you can pass an array of options.

All the options are list here :

Option name Usage Value
class Define the class of the field string A class name
label Define the label for the field string The label content
placeholder Define placeholder of the field string The placeholder
required Define if the field is required bool true / false (default to true)
value You can define the value of the field here string The value of the field

Example :

Configuration

Form-generator is fully configurable. You can for example disable the type detection with the name.

You can use "get" method to see the value of a key

Key names are case-insensitive.

You can also pass an array to the FormConfig constructor for define config rules.

Config Rules

All the config rules can be changed are listed here :

Rule Name Default value Values can be attributed
empty_generated_field true bool true / false
form_action null string The route / file form action
form_class null string A class name
form_method POST string GET / POST (for now)
form_submit false bool true / false
form_submit_value null string A value
full_html_structure false bool true / false
type_detection true bool true / false

empty_generated_field

This config rule will remove in-memory field when the "generate" method is call. Default value is "true".

form_action

With this rule, you can define the action of the <form>. Default value is "null".

Note : This rule has no effect if the "full_html_structure" rule is not on "true" value.

form_class

With this rule, you can define the class of the <form>. Default value is "null".

Note : This rule has no effect if the "full_html_structure" rule is not on "true" value.

form_method

Set the method of the form. Default value is "POST".

Note : This rule has no effect if the "full_html_structure" rule is not on "true" value.

form_submit

Define if the form contains a "submit" input or not. Default is "true".

Note : This rule has no effect if the "full_html_structure" rule is not on "true" value.

form_submit_value

Set the value of the "submit" input. Default value is "null".

Note : This rule has no effect if the "full_html_structure" and "form_submit" rules are not on "true" value.

full_html_structure

When this rule is activate, the "generate" method will return entire html form structure. Default value is "false".

type_detection

With this rule, if the name is a correct form type, it will be used for the type.

Examples

Making a login form using bootstrap template.


All versions of form-generator 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 moon250/form-generator contains the following files

Loading the files please wait ....