Download the PHP package czubehead/bootstrap-4-forms without Composer

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

Bootstrap 4 forms for Nette

Please use English in potential issues, let's keep it clean, shall we?

This is a library that lets you use Bootstrap 4 forms in Nette framework.

Rather than being just a renderer, this introduces a custom set of controls (which covers all default controls) and a renderer.

Note that this is an alpha, so it may be buggy. That is where you can help by reporting issues.

See example here

Features

Installation

The best way is via composer:

Note that if you simply clone the main branch from this repo, it is not guaranteed to work, use releases instead

Requirements

Compatibility

This package is compatible with any version version of Bootstrap 4 (last tested on v4.0.0-beta.2)

How to use

Form

Probably the main class you will be using is Czubehead\BootstrapForms\BootstrapForm. It has all the features of this library pre-configured and extends Nette\Application\UI\Form functionality by:

It will behave pretty much the same as the default Nette form, with the exception of not grouping buttons. That feature would only add unnecessary and deceiving overhead to this library, use grid instead, it will give you much finer control

Render modes

  1. Vertical (Enums\RenderMode::VerticalMode) all controls are below their labels
  2. Side-by-side (Enums\RenderMode::SideBySideMode) controls have their labels on the left. It is made up using Bootstrap grid. The default layout is 3 columns for labels and 9 for controls. This can be altered using BootstrapRenderer::setColumns($label, $input).
  3. Inline Enums\RenderMode::Inline all controls and labels will be in one enormous line

Controls / inputs

Each default control has has been extended bootstrap-enabled controls and will render itself correctly even without the renderer. You can distinguish them easily - they all have Input suffix.

TextInput

TextInput can have placeholder set ($input->setPlaceholder($val)). All text-based inputs (except for TextArea) inherit from this control.

DateTimeInput

Its format can be set ($input->setFormat($str)), the default is d.m.yyyy h:mm (though you must specify it in standard PHP format!).

You may use DateTimeFormats class constants as a list of pretty much all formats:

is the default format for DateTime. See its PhpDoc for further explanation.

UploadInput

Nothing out of ordinary, but it Needs <html lang="xx"> attribute to work.

Has property buttonCaption, which sets the text on the button on the left. The right button is set by Bootstrap CSS, which depends <html lang="xx">.

SelectInput, MultiSelectInput

These can accept nested arrays of options.

will generate

Renderer

The renderer is enhanced by the following API:

property type meaning
mode int constant see render mode above in form section
gridBreakPoint string / null Bootstrap grid breakpoint for side-by-side view. Default is 'sm'
groupHidden bool if true, hidden fields will be grouped at the end. If false, hidden fields are placed where they were added. Default is true.

Grid

The library provides a way to programmatically place controls into Bootstrap grid and thus greatly reduces the need for manual rendering.

Simply add a new row like this:

And firstname and surname will be beside each other.

Notes

Assisted manual rendering

Why do we use manual rendering? Mostly to just rearrange the inputs, we rarely create a completely different feel. But there is a hefty price for using manual rendering - we have to do almost everything ourselves, even the things the renderer could do for us. Only if there were a way to let the renderer do most of the work...

What can it do

Assisted manual rendering will render label-input pairs for you using a filter. This means that it will take care of wrapping things into div.form-group and validation messages - the most mundane thing to implement in a template.

Implementation

First of all, you must implement this yourself, this won't work out of the box! The implementation is quite dirty, but I think the benefits outweigh this cost.

It works like this:

1. Implement a filter

add a new filter to your latte engine, for example:

2. Use it

That will result in



All versions of bootstrap-4-forms with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
nette/forms Version ^2.4
nette/application Version ^2.4
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 czubehead/bootstrap-4-forms contains the following files

Loading the files please wait ....