Download the PHP package corbinjurgens/qform without Composer
On this page you can find all versions of the php package corbinjurgens/qform. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download corbinjurgens/qform
More information about corbinjurgens/qform
Files in corbinjurgens/qform
Package qform
Short Description Quickly create inputs. Made for Bootstrap 4 but you can alter the template
License MIT
Informations about the package qform
Introduction
Confirmed working on Laravel 7.0.0, 8.0.0 and 8.73.2 projects
Created for personal use, feel free to use / extend
QForm for Laravel does a bunch of html form stuff, making use of Laravel components
- Create most types of html inputs with a single component
- Automatically get old() values and errors
- Make use of the additional functions to automatically prefix your input form name attributes
- Customizable templates
-
In the provided base Bootstrap 4 template, it makes some attempts to provide labelling, error and other accesibility features.
- The input will automatically look for errors and old values based on value given by name
- The input will look to array or model given by @QFormData() or directly from the "data" attribute to get input value
Warnings
For select and other variable input types, strict comparison is used. If your input value is an integer, and is declared as an integer in the variables array, you will need to set the "int" attribute so that it will be cast as an integer before comparison
Setup
Composer
composer require corbinjurgens/qform
Manual Installation
Copy the following to main composer.(in the case that the package is added to packages/corbinjurgens/qform)
and run
Add the following to config/app.php providers
Add alias to config/app.php alias
Basic Usage
Directly
Using components as is, and benefit purely from the template taking care of the html and css
Simple inputs
Array input, ie. anything that has multiple options
You should be sure to set the int attribute if your variable keys are integer, so that the value can be compared correctly
Smartly
Using components with the QForm tools is the intended usage of this package
In your template set the target model or array. All inputs after this will use this data to retrieve values
You can also set data directly for each input
Bonus
You can create an input using a blade function
Is the alternative method to
Other functions
Use the prefix function and pass an array (or null to clear), and it will automatically prefix the inputs name attribute
You can also use prefixIn() and prefixOut() to add a set of prefixes, and then after back out again. QForm::prefixReset() or @QFormPrefix with no parameter can be used to clear the prefix setting completely.
Customize template
Publish views via
You can edit the files directly, or the component templates "x-qform-input", "x-qform-error" and "x-qform-submit" support taking a suffix.
Make a copy of the template, and add suffix for example input.blade.php
becomes input_bootstrap3.blade.php
, then you can set the suffix "bootstrap3" directly on the component like <x-qform-input template="bootstrap3" .../>, or globally via QForm::setGlobalTemplate('bootstrap3')
or @QFormTemplate('bootstrap3')
Other stuff
You can quickly create forms with the <x-qform-form action="..." > <x-qform-form />
component. method will default to POST and also provide @csrf and @method when necessary
A bunch of features aren't documented here
Notes
This code is not thoroughly and not to any standard. Provided as is.