npmweb/laravel-forms 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

npmweb/laravel-forms

最新稳定版本:2.0.1

Composer 安装命令:

composer require npmweb/laravel-forms

包简介

Extends Laravel's FormBuilder to lay out form elements for Bootstrap or Foundation

README 文档

README

Extends the laravelcollective/html FormBuilder object (Form:: facade) to automatically output form fields with Foundation- or Bootstrap-specific wrapping markup around them.

Example

With foundationBasicGrid selected, the following call:

{{ Form::text('name',null,['errors'=>$errors]) }}

Will output:

<div class="row">
    <div class="medium-12 columns">
        <label for="name">
        	Name
            <input id="name" placeholder="Name" maxlength="150"
                name="name" type="text" value="Parent Organization">
        </label>
    </div>
</div>

If there is a validation error on the field, it will output:

<div class="row">
    <div class="medium-12 columns">
        <label for="name">
        	Name
            <input id="name" placeholder="Name" maxlength="150"
                name="name" type="text" value="Parent Organization">
            <small class="error">The img field is required.</small>
        </label>            
    </div>
</div>

You can easily change the grid column classes, and if you use bootstrapBasicGrid the equivalent Bootstrap 3 markup will be used.

Installation

  1. Require "npmweb/laravel-forms": "^2.0" in your composer.json file.
  2. Run composer install or composer update to download it and have the autoloader updated.3.
  3. Open app/config/app.php and make the following changes under the providers key: a. If 'Collective\Html\HtmlServiceProvider' is there, comment it out b. Add 'NpmWeb\FormBuilder\HtmlServiceProvider'

Configuration

You will probably want to change the default configuration. First, publish the package config file:

$ php artisan vendor:publish --provider="NpmWeb\FormBuilder\HtmlServiceProvider"

The following options are available:

  • 'driver': Defaults to 'foundationBasicGrid' (Foundation 5) but can also be set to 'bootstrapBasicGrid' (Bootstrap 3). This changes what markup is generated to fit with the given CSS framework's default form layout.
  • 'col_width': The grid class for the form field's container element. For example, in Foundation 'large-6' will make the container take up 6 out of 12 columns.
  • 'row_per_field': Defaults to false, in which case each form field is outputted directly, and you have to wrap it in a row yourself. If you set it to true, each form field container is wrapped in a row, forcing it to be one field per row.

Here's some more information about the included drivers:

  • foundationBasicGrid: Uses the basic Foundation form markup, with a <label> tag wrapping the inputs. Layed out within a grid row and column.
  • bootstrapBasicGrid: Uses the basic Bootstrap form markup, with a <label> tag as a prior-child of the input. Layed out within a grid row and column.

Usage

Just use any of Laravel's normal Form:: methods, such as Form::text() or Form::select(). Instead of outputting the bare form control, it will also output the wrapping DOM elements appropriate to your selected CSS framework.

Additionally, a Form::readonly() method has been added. This outputs a read-only value wrapped in the same DOM elements, allowing you to include read-only "fields" in your forms.

License

This code is released under the MIT License. See the LICENSE file for details.

npmweb/laravel-forms 适用场景与选型建议

npmweb/laravel-forms 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.87k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 04 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 npmweb/laravel-forms 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 npmweb/laravel-forms 我们能提供哪些服务?
定制开发 / 二次开发

基于 npmweb/laravel-forms 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.87k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 21
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 7
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-04-08