Download the PHP package efabrica/neoforms without Composer

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

Packagist Version Packagist Downloads

NeoForms are the very much needed medicine for Nette\Forms.

Installation

Documentation

Using ActiveRowForm

Component Usage in Presenter

Component Usage in Latte Templates

Simple Rendering

Custom HTML Structure inside the <form> tag

Stand-alone HTML Template for Form

Grouping Form Elements

.row .col Grid Layout in PHP


Latte Tags (API) Documentation

{neoForm}

The {neoForm} tag is used to render the <form> element in your HTML. It can also render all the unrendered inputs at the end of the form. The argument for this tag is the name of the control without quotes.

To render an entire form without specifying any sub-elements, use the following syntax:

If you want to exclude certain form fields from rendering, you can use rest => false like this:

This will render an empty <form>, similar to using an empty {form} tag.


{formRow}

The {formRow} tag is used to render a form label and form input inside a wrapping group. It accepts various options. The argument for this tag is a BaseControl instance (e.g., $form['title']).

Here are some examples of how to use {formRow}:

This renders a form row with a custom class, resulting in <div class="mt-3">...</div>.

If you are using a Bootstrap template, this will render a form group with a class, resulting in <div class="form-group mt-3">...</div>.

You can also add attributes to the input or label elements using options:

This renders a form row with an input element that has a data-tooltip attribute.

This renders a form row with a label element that has a data-toggle attribute.


{formGroup}

The {formGroup} tag accepts a ControlGroup as a required argument and renders all controls in the group. It internally uses {formRow} to handle rendering.

Example usage:


{formLabel}

The {formLabel} tag is used to render a <label> element. The argument is a BaseControl instance.

Example usage:

This renders a label element with a custom class and data attributes.

If the form element is a hidden field or checkbox, the label is rendered as an empty HTML string.


{formInput}

The {formInput} tag is used to render an <input>, <textarea>, <button>, or any other essential part of a form row. The argument is a BaseControl instance.

Example usage:

This renders an input element with an empty data-select2 attribute.


Applying Attributes

Attributes can be applied to form elements using options. Here are some commonly used attributes:

"icon"

The "icon" attribute, when applied to buttons, adds an icon before the text. For example:

You can customize how the icon is added in your template.

"description"

The "description" attribute adds gray helper text under input elements. For example:

"info"

The "info" attribute adds a blue info circle tooltip next to the label. For example:

"readonly"

The "readonly" attribute, when set to true, makes the value non-modifiable and not submitted. It is rendered as a badge. Examples:

You can also provide a callback function for dynamic readonly behavior.

"class"

The "class" attribute allows you to override a class or any other HTML attribute to the row/input/label. For example:

If you want to keep the classes from your template, use +class instead:

This also works:

If you want to force remove a class from your template, use false instead:

"input" and "label"

You can apply these attributes to the {formRow} tag to pass HTML attributes to the input and label elements, respectively. Example:


FormCollection

Usage:

You render the form as any other control in the form. ({formRow} or automatically)

Processing

You don't have to use the Diff API. If you for example only use a simple collection of single text inputs, you might find it easier to just persist the new array of values.


Custom Template

To create your own extended template for rendering forms, you can follow our examples. Below is a step-by-step guide on how to create your custom extended template using Bootstrap 4 as an example:

Step 1: Create a New PHP Class

Create a new PHP class for your extended template by extending the base template class. In this example, we'll call it Bootstrap5FormTemplate. Make sure to place this class in an appropriate namespace, just like in the provided code.

Step 2: Customize Form Elements

Override the methods in your extended template class to customize the rendering of form elements according to your preferred Bootstrap 4 styling. For example, you can define how text inputs, buttons, checkboxes, and other form elements should be rendered with Bootstrap classes.

Here's an example of customizing the rendering of text inputs:

Step 3: Customize Form Labels

You can also customize how form labels are rendered. In Bootstrap, you may want to add the col-form-label class for proper alignment. Override the formLabel method to achieve this:

Step 4: Customize Buttons

For buttons, you can add Bootstrap classes and icons if desired. Customize the rendering of buttons like this:

Step 5: Customize Other Form Elements

Repeat similar customization for other form elements like checkboxes, radio buttons, select boxes, etc., based on your desired styling.

Step 6: Implement Additional Styling

If your template requires additional styling for specific elements or form groups, you can do so in your extended template class.

Step 7: Apply Your Custom Template To use your custom template, you need to instantiate it and set it as the template for your forms when rendering. For example:

If you want to use your custom template for all forms, you can set it as the default template by rewiring your auto-wiring :)

By following these steps, you can create your own extended template for rendering forms in a way that aligns with Bootstrap 4 or any other custom styling you prefer. Customize the template methods according to your specific styling needs.


All versions of neoforms with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
nette/forms Version ^3.1
latte/latte Version ^2.11 || ^3.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 efabrica/neoforms contains the following files

Loading the files please wait ....