承接 ride/lib-form 相关项目开发

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

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

ride/lib-form

最新稳定版本:1.2.3

Composer 安装命令:

composer require ride/lib-form

包简介

Form library of the Ride framework

README 文档

README

Form library of the PHP Ride framework.

What's In This Library

RowFactory

The RowFactory interface is used to create a Row based on a simple name. Using this factory adds flexibility to the forms since every row can be overwritten with another implementation if needed.

A default implementation is provided by the GenericRowFactory class.

Row

The Row interface is used to implement a row type. This can be a scalar type like a string, a number, ... all generic HTML form elements. It can also be a component or a collection of components.

The following rows are provided by this library:

  • button
  • collection
  • component
  • date
  • email
  • file
  • hidden
  • image
  • label
  • number
  • object
  • option
  • password
  • select
  • string
  • text
  • time
  • website
  • wysiwyg

Component

The Component interface is used to group a combination of rows into a single row or form. For example, a datetime component can combine a date row and a time row together into a single row. Creating components will add reusability to your forms.

Widget

The Widget interface is used to display a Row. Certain rows can have the same logic but a different view representation. Think about an option row which can be represented through a list of checkboxes (or radio buttons) or a select field.

View

The View interface is used to send the form to the UI. It removes everything needed to build the form and makes sure the form is serializeable.

Code Sample

Check this code sample to see some possibilities of this library:

<?php

function createForm(Form $form) {
    // id of the form
    $form->setId('form-example');
    // action to catch submission of different forms on one page
    $form->setAction('submit-example');
    
    $form->addRow('name', 'string', array(
        'label' => 'Name',
        'description' => 'Enter your name',
        'filters' => array(
            'trim' => array(),
        ), 
        'validators' => array(
            'required' => array(),
        ),
    ));
    $form->addRow('gender', 'option', array(
        'label' => 'Gender',
        'description' => 'Select your gender',
        'default' => 'F',
        'options' => array(
            'F' => 'Female',
            'M' => 'Male',
            'O' => 'Other', 
        ),
        'validators' => array(
            'required' => array(),
        ),
    ));
    $form->addRow('extra', 'string', array(
        'label' => 'Extra',
        'description' => 'Extra row to show off some other options',
        'multiple' => true,
        'disabled' => false,
        'readonly' => false,
        'attributes' => array(
            'data-extra' => 'An extra attribute for the HTML element',
        ),
    ));
    
    return $form->build();
}

Related Modules

Installation

You can use Composer to install this library.

composer require ride/app-form

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-02-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固