Download the PHP package ddrcha/easyfield without Composer
On this page you can find all versions of the php package ddrcha/easyfield. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ddrcha/easyfield
More information about ddrcha/easyfield
Files in ddrcha/easyfield
Package easyfield
Short Description My little input builder for Laravel 6 and more
License MIT
Homepage https://github.com/ddrcha/easyfield
Informations about the package easyfield
Laravel - Easyfield
My little input builder for Laravel 6 and more
Installation
First install the package via composer
Then set reference to the package in adding two lines in your config/app.php file :
Easyfield integrates by default templates for Bootstrap 5 and Materialize.
You must publish one of them to use the package :
All templates (one by input type) become so available in your "[project]/resources/views/vendor/easyfield" folder. You are free to modify it and add others views (that you can set with "template" option).
Icons
By default Easyfield use Font Awesome icons. If you want to use materialize icons, you must publish config file and modify the "icons" variable :
(A file named "easyfield.php" will be added into your "[project]/config" folder).
Usage
Don't forget to include libraries you want to use (Bootstrap 5, Materialize, Datepicker, Select2, Font Awesome, etc...) in your view before using Easyfield.
The syntax
To display a field use this syntax :
All available options in the detail :
Option | Required | Description |
---|---|---|
type | X | String. 'type=' of the field. Possible values : 'text', 'password', 'textarea', 'select', 'file', 'radio', 'checkbox', 'submit' (button), 'switch' |
name | X | String. 'name=' of the field |
label | String. Text displayed before the input | |
required | String. Display * before label if 'true', 'false' by default | |
icon | String. Add icon before field. The used library can be setted in config file | |
class | String. Additional classes spent to the input field | |
width | Integer. Size of the field (in 12 grid columns layout). '12' by default | |
data | X (only for 'select' type) | Eloquent collection |
note | String. Display a small information after field | |
value | String. If you want to set a particular value by default | |
additional | Associative Array (key => value). Add all additional attributes you need ! | |
template | String. Use a custom template file (ex : "text2" will use "resources\views\vendor\easyfield\text2.blade.php") |
Simple examples
Nota : For a best rendering insert all your fields into tags (if you use Bootstrap 4).