2017 © Pedro Peláez
 

library tforms

TForms is a flexible forms validation library for PHP API project.

image

wudege/tforms

TForms is a flexible forms validation library for PHP API project.

  • Monday, February 20, 2017
  • by wudege
  • Repository
  • 1 Watchers
  • 1 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

tforms

TForms is a flexible forms validation library for PHP API project., (*1)

Software License Latest Stable Version Total Downloads Twitter URL, (*2)

INSTALL

  • Use the composer command or the composer.json file. That's the recommend way. And the SDK is here wudege/tforms
$ composer require wudege/tforms

USAGE


require __DIR__ . '/../vendor/autoload.php'; class UserEditForm extends \TForms\Form { const GENDER_MALE = 1; const GENDER_FEMALE = 0; public $username; public $email; public $age; public $gender; public $blog; /** * * @author wudege <hi@wudege.me> * @return array */ public function attributeNames() { return [ 'username', 'email', 'age', 'gender', 'blog', ]; } public function attributeLabels() { return [ 'username', 'email', 'age', 'gender', 'blog', ]; } public function rules() { return [ ['username, email, age, gender, blog', 'required'], ['username', 'length', 'min' => 4, 'max' => 32], ['email', 'email'], ['age', 'numerical', 'min' => 18, 'max' => 28, 'integerOnly' => true], ['gender', 'in', 'range' => [self::GENDER_MALE, self::GENDER_FEMALE]], ['blog', 'url'], ]; } } $form = new UserEditForm(); $form->attributes = [ 'username' => 'wudege', 'email' => 'hi@wudege.me', 'age' => 20, 'gender' => 1, 'blog' => 'https://wudege.me', ]; try { $form->validate(); } catch (\TForms\Exception\ValidationException $e) { die($e->getMessage()); } die('done');

TEST

bash $ ./vendor/bin/phpunit tests/TForms/Tests, (*3)

LICENSE

The MIT License (MIT). License File., (*4)

The Versions

20/02 2017

dev-master

9999999-dev

TForms is a flexible forms validation library for PHP API project.

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

by Avatar wudege

20/02 2017

v0.0.2

0.0.2.0

TForms is a flexible forms validation library for PHP API project.

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

by Avatar wudege

18/02 2017

v0.0.1

0.0.1.0

TForms is a flexible forms validation library for PHP API project.

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

by Avatar wudege