Download the PHP package mdbottino/forms without Composer

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

Forms

Easy, framework agnostic HTML form rendering. This is meant to render a form in a way that is reproducible, reusable and consistent.

There is no (and there will not be any) validation whatsoever. It only deals with making valid HTML fields and forms.

There is no (and there will not be any) integration to any framework, it uses associative arrays or stdClasses for prepopulating forms (like when you edit a database entity).

The goal is to use one (or a few) generic template(s) to render all fields in a consistent way.

Disclaimer: It does not have all HTML5 fields implemented and it does not do any validation of the attributes.

Installation

Usage

In order to use in a template (or plain PHP if you so desire) you have to subclass BaseForm and in the constructor do any needed configuration. The subclass' constructor must call the parent constructor and set the fields attribute. In the fields array you need to instantiate a specific field with name and label at a minimum.

Basic example:

The use of the $src variable is optional, it allows to populate the form with data if given. This allows for adding or editing records easily

The keys/properties must match the names of the fields given upon creation.

The fields are accessed through the method fields which returns the array of fields.

The label is rendered through the method label of each field. The widget is rendered through the method widget of each field.

The previous code would produce the following HTML:

Using a blade template it could look like this

It defaults to POST as method, no action and no enctype. If one of the fields is a FileField it will set the enctype to multipart/form-data. It can be overriden by using setAction, setMethod and setEnctype in the form.

Styling

Styling is as easy as it gets. The third and optional argument options supports a variety of keywords that changes the way the rendering behaves.

One of them is attrs, which equates to the attributes of the rendered field. If you give it a key named class it will display that value in the resulting HTML.

The resulting HTML will be:

Styling using a blade template could look like this:

Advanced usage

TODO

Examples

TODO


All versions of forms 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 mdbottino/forms contains the following files

Loading the files please wait ....