定制 alterfw/php-form-generator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

alterfw/php-form-generator

Composer 安装命令:

composer require alterfw/php-form-generator

包简介

This library has the goal of make simple the creation and population of HTML forms

README 文档

README

This library has the goal of make simple the creation and population of HTML forms

API

http://pelegrinodev.com/repos/fg/api/

Usage example

<?php
		require_once 'fg/load.php';

		$form = Form::create('formaction.php'); // form action attribute
		$form
			->add(Form::text('user[name]')->setLabel('Username: ')) // adds a text field with a name and wrapped with a div tag
			->add(Html::tag('br')) // adds a non-field object
			->add(Form::password('user[password]')->setLabel('Password: ')) // adds a password field with a name
			->add(Html::tag('br'))
			->add(
				Form::radios('gender') // create a collection of radio buttons
					->add('M', 'Male') // add a radio with value "M" and label "Male"
					->add('F', 'Female') // add a radio with value "F" and label "Female"
			)
			->add('<ul>')
			->add(
				Form::checkboxes('interests[]') // create a collection of checkboxeseaa
					->add('games', 'Games')
					->add('animes', 'Animes')
					->add('o_thing', 'Other things')
					->setWrapper(Html::tag('li')->setClass('li-item')) // changes the wrapper, default is div
			)
			->add('</ul>')
			->add(
				Form::select('songs[]')->setMultiple(true) // create a select multiple input
					->add('sth', 'Stairway to Heaven')
					->add('nem', 'Nothing Else Matters')
					->add('fb', 'Free bird')
					->add('others', 'Others')
			)
			->add(
				Form::checkbox('newsletter')->setLabel('Receive newsletter? ') // create a single checkbox
			);
		
		echo $form; // or echo $form->render()

If you wanna populate your form, you can use the populate method:

<?php
		$form->populate(array(
			'user' => array(
				'name' => 'myuser_name' // user[name] field
			),
			'songs' => array('sth', 'fb') // select these two songs for the field songs[]
			...
		));

ROADMAP

  • Write documentation

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固