PHPackages                             wudege/tforms - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. wudege/tforms

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

wudege/tforms
=============

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

v0.0.2(9y ago)112MITPHPPHP ^5.6 || ^7.0

Since Feb 18Pushed 9y ago1 watchersCompare

[ Source](https://github.com/wudege/tforms)[ Packagist](https://packagist.org/packages/wudege/tforms)[ RSS](/packages/wudege-tforms/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (3)Used By (0)

tforms
======

[](#tforms)

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

[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE)[![Latest Stable Version](https://camo.githubusercontent.com/69949e0ffe49b92b887e834a4ca90e8332ce65d0268f9374e74e93c78f186d71/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7775646567652f74666f726d732e737667)](https://packagist.org/packages/wudege/tforms)[![Total Downloads](https://camo.githubusercontent.com/f3b2daaeba59fd44c817e0eb5422e139cd9cdd235c1a60b0306c426db3fd8ceb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7775646567652f74666f726d732e737667)](https://packagist.org/packages/wudege/tforms)[![Twitter URL](https://camo.githubusercontent.com/a29718bad75dd7709d052812131602e05011ee8db979383af824ce0aca77297c/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f75726c2f687474702f736869656c64732e696f2e7376673f7374796c653d736f6369616c267374796c653d666c61742d737175617265)](https://twitter.com/wudege)

INSTALL
-------

[](#install)

- Use the composer command or the composer.json file. That's the recommend way. And the SDK is here [`wudege/tforms`](https://packagist.org/packages/wudege/tforms)

```
$ composer require wudege/tforms
```

USAGE
-----

[](#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
     * @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
----

[](#test)

```
$ ./vendor/bin/phpunit tests/TForms/Tests
```

LICENSE
-------

[](#license)

The MIT License (MIT). [License File](https://github.com/wudege/tforms/blob/master/LICENSE).

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

2

Last Release

3417d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/19968467?v=4)[wudege](/maintainers/wudege)[@wudege](https://github.com/wudege)

---

Top Contributors

[![wudege](https://avatars.githubusercontent.com/u/19968467?v=4)](https://github.com/wudege "wudege (7 commits)")

---

Tags

form-validationformstformsvalidationvalidationsvalidator

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/wudege-tforms/health.svg)

```
[![Health](https://phpackages.com/badges/wudege-tforms/health.svg)](https://phpackages.com/packages/wudege-tforms)
```

###  Alternatives

[chaoswey/taiwan-id-validator

台灣身分證、統一編號驗證

319.9k](/packages/chaoswey-taiwan-id-validator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
