luthfi/formfield
Composer 安装命令:
composer require luthfi/formfield
包简介
Laravel Form Field the extension of Laravelcollective Form for Laravel 5.3 and newer with Twitter Bootstrap 4.
README 文档
README
This package is the extension of Laravelcollective Form for Laravel 5 and newer with Twitter Bootstrap 3, 4 and 5 form fields wrapper.
How to install
For Bootstrap 5
If you are using Bootstrap 5, please use 3.* version instead:
composer require luthfi/formfield 3.*
For Bootstrap 4
If you are using Bootstrap 4, please use 2.* version instead:
composer require luthfi/formfield 2.*
For Bootstrap 3
If you are using Bootstrap 3, please use 1.* version instead:
composer require luthfi/formfield 1.*
Install this package through Composer. Run following from terminal:
composer require luthfi/formfield
For laravel 5.5 and newer
this package will auto discovered
For laravel 5.3 and 5.4
Update config/app.php, add provider and aliases :
// providers Luthfi\FormField\FormFieldServiceProvider::class, // aliases 'FormField' => Luthfi\FormField\FormFieldFacade::class, 'Form' => Collective\Html\FormFacade::class, 'Html' => Collective\Html\HtmlFacade::class,
How to use
In your blade file, use this following sintax :
{!! FormField::text('name') !!}
will produce:
<div class="form-group "> <label for="name" class="control-label">Name</label> <input class="form-control" name="name" id="name" type="text"> </div>
Or other example for Checkbox and Radios. We can use numeric array or associative array for Labels and Values :
{!! FormField::checkboxes('group', [1 => 'Admin', 'Member']) !!} {!! FormField::radios('status', ['a' => 'Active', 'b' => 'Inactive']) !!}
And they will produce :
<!-- Checkboxes --> <div class="form-group "> <label for="group" class="control-label">Group</label> <div> <div class="form-check form-check-inline"> <input id="group_1" class="form-check-input" name="group[]" value="1" type="checkbox"> <label for="group_1" class="form-check-label">Admin</label> </div> <div class="form-check form-check-inline"> <input id="group_2" class="form-check-input" name="group[]" value="2" type="checkbox"> <label for="group_2" class="form-check-label">Member</label> </div> </div> </div> <!-- Radios --> <div class="form-group "> <label for="status" class="control-label">Status</label> <div> <div class="form-check form-check-inline"> <input id="status_a" class="form-check-input" name="status" value="a" type="radio"> <label for="status_a" class="form-check-label">Active</label> </div> <div class="form-check form-check-inline"> <input id="status_b" class="form-check-input" name="status" value="b" type="radio"> <label for="status_b" class="form-check-label">Inactive</label> </div> </div> </div>
Avaliable Form Fields
{!! FormField::open($options) !!} {!! FormField::text('name') !!} {!! FormField::textarea('field_name') !!} {!! FormField::select('field_name', $options) !!} {!! FormField::multiSelect('field_name', $options) !!} {!! FormField::email('email_field') !!} {!! FormField::password('password_field') !!} {!! FormField::radios('status', ['a' => 'Active', 'b' => 'Inactive']) !!} {!! FormField::checkboxes('group', [1 => 'Admin', 'Member']) !!} {!! FormField::textDisplay('label', 'value_to_display') !!} {!! FormField::file('file_field') !!} {!! FormField::price('price_field') !!} {!! FormField::close() !!}
luthfi/formfield 适用场景与选型建议
luthfi/formfield 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 35.53k 次下载、GitHub Stars 达 16, 最近一次更新时间为 2017 年 01 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 luthfi/formfield 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 luthfi/formfield 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 35.53k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 17
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-01-21