承接 kris/laravel4-form-builder 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

kris/laravel4-form-builder

Composer 安装命令:

composer require kris/laravel4-form-builder

包简介

Laravel form builder - symfony like

README 文档

README

Build Status Coverage Status Total Downloads Latest Stable Version License

Laravel 4 form builder

Form builder for Laravel 4 inspired by Symfony's form builder. With help of Laravels FormBuilder class creates forms that can be easy modified and reused. By default it supports Bootstrap 3.

Laravel 5

For laravel 5 version check laravel-form-builder

Documentation

For detailed documentation refer to http://kristijanhusak.github.io/laravel-form-builder/.

Note There are small differences between version 4 and 5 (Configuration path, etc.), so please be aware of those.

Changelog

Changelog can be found here

###Installation

{
    "require": {
        "kris/laravel4-form-builder": "1.6.*"
    }
}

run composer update

Then add Service provider to config/app.php

    'providers' => [
        // ...
        'Kris\LaravelFormBuilder\FormBuilderServiceProvider'
    ]

And Facade (also in config/app.php)

    'aliases' => [
        // ...
        'FormBuilder' => 'Kris\LaravelFormBuilder\Facades\FormBuilder'
    ]

Quick start

Creating form classes is easy. Lets assume PSR-4 is set for loading namespace App in app/Project folder. With a simple artisan command we can create form:

php artisan make:form app/Project/Forms/SongForm --fields="name:text, lyrics:textarea, publish:checkbox"

Form is created in path app/Project/Forms/SongForm.php with content:

<?php namespace App\Forms;

use Kris\LaravelFormBuilder\Form;

class SongForm extends Form
{
    public function buildForm()
    {
        $this
            ->add('name', 'text')
            ->add('lyrics', 'textarea')
            ->add('publish', 'checkbox');
    }
}

If you want to instantiate empty form without any fields, just skip passing --fields parameter:

    php artisan make:form app/Project/Forms/PostForm

Gives:

<?php namespace App\Forms;

use Kris\LaravelFormBuilder\Form;

class PostForm extends Form
{
    public function buildForm()
    {
        // Add fields here...
    }
}

After that instantiate the class in the controller and pass it to view:

<?php namespace App/Http/Controllers;

use Illuminate\Routing\Controller as BaseController;
use Kris\LaravelFormBuilder\FormBuilder;

class SongsController extends BaseController {

    public function create()
    {
        $form = \FormBuilder::create('App\Forms\SongForm', [
            'method' => 'POST',
            'url' => route('song.store')
        ]);

        return view('song.create', compact('form'));
    }
}

Print the form in view with form() helper function:

<!-- resources/views/song/create.blade.php -->

@extend('layouts.master')

@section('content')
    {{{ form($form) }}}
@endsection

Above code will generate this html:

<form method="POST" action="http://example.dev/songs">
    <input name="_token" type="hidden" value="FaHZmwcnaOeaJzVdyp4Ml8B6l1N1DLUDsZmsjRFL">
    <div class="form-group">
        <label for="name" class="control-label">Name</label>
        <input type="text" class="form-control" id="name">
    </div>
    <div class="form-group">
        <label for="lyrics" class="control-label">Lyrics</label>
        <textarea name="lyrics" class="form-control"></textarea>
    </div>
    <div class="form-group">
        <label for="publish" class="control-label">Publish</label>
        <input type="checkbox" name="publish" id="publish">
    </div>
</form>

Contributing

Project follows PSR-2 standard and it's covered with PHPUnit tests. Pull requests should include tests and pass Travis CI build.

To run tests first install dependencies with composer install.

After that tests can be run with vendor/bin/phpunit

kris/laravel4-form-builder 适用场景与选型建议

kris/laravel4-form-builder 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.35k 次下载、GitHub Stars 达 22, 最近一次更新时间为 2015 年 01 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 kris/laravel4-form-builder 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 22
  • Watchers: 4
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-28