osoobe/wtforms 问题修复 & 功能扩展

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

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

osoobe/wtforms

最新稳定版本:v1.2

Composer 安装命令:

composer require osoobe/wtforms

包简介

WTForms for PHP

README 文档

README

PHP Forms library inspired in python wtforms

Installing WTForms-PHP

There are two ways to get WTForms-PHP, i.e. by composer install or download the package manually.

Get WTForms-PHP via composer

You can run the following terminal command in the root directory of your project:

composer install wtforms\wtforms

or add the the following lines to your composer.json file as a requirement:

wtforms\wtforms: 1.0

Get WTForms-PHP via download

You can download the latest version of the project here

Using WTForms-PHP in your project

If your using composer with autoloading, you can simple use the WTForms namespace to load specific classes or modules from the WTForms-PHP library. For instance:

use WTForms\Form;
use WTForms\Fields\StringField;

Otherwise, you have to manually include them by doing the following:

require_once 'path/to/wtforms-php/src/Form.php';
require_once 'path/to/wtforms-php/src/fields/StringField.php';

Create a WTForm Object

The example below is used to create form object with a list of form input fields.

class AddressForm extends Form{
    function setUp(){
        $this->_fields = [
            "street" => (new Fields\StringField("Street")),
            "town" => (new Fields\StringField("Town/District"))->required(),
            "parish" => (new Fields\StringField("Parish"))->required(),
            "country" => (new Fields\StringField("Country"))->required(),
        ]
    }
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: LGPLv2
  • 更新时间: 2015-08-30