PHPackages                             qix/phorms - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. qix/phorms

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

qix/phorms
==========

A simple Forms library for PHP

513PHP

Since Apr 8Pushed 13y ago1 watchersCompare

[ Source](https://github.com/qix/phorms)[ Packagist](https://packagist.org/packages/qix/phorms)[ RSS](/packages/qix-phorms/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Phorms
======

[](#phorms)

Phorms is a simple, yet extensible, library for website forms generated php. It is designed for systems that have a large number of user input forms, and allows definition of complicated forms with a simple syntax.

There is a focus on server side data validation, as well as clear error messages for any problems encountered.

Installation with Composer
--------------------------

[](#installation-with-composer)

Declare phorms as a dependency in your projects composer.json file:

```
{
  "require": {
    "qix/phorms": "dev-master"
  }
}
```

Show me the code
----------------

[](#show-me-the-code)

```
Phorms\Csrf::setSecret('mysecret');

$form = new Phorms\Form([
  // Set up a fieldset for the fields
  '@fieldset:Your request',

  // Input boxes are the default, and are defined simply:
  'firstname' => 'Firstname',

  // Passing an array as the second option allows extra properties:
  'email' => ['Email', 'type'=>'email', 'required'=>True],

  // Some types are automatically detected, such as a select box:
  'topic' => ['Topic', array(
    'topics/barley.txt' => 'Barley',
    'topics/rice.txt' => 'Rice',
    'topics/wheat.txt' => 'Wheat',
  )],

  // Controls can also be provided as objects (simple challenge response)
  new Phorms\Element_Checkbox(array(
    'name' => 'human',
    'caption' => 'Are you human?',
    'required' => True,
  )),

  // Opening another fieldset will automatically close the previous one
  '@fieldset:Action(s)',
  '@submit:Notify me'
]);

if ($data = $form->data()) {
  // Form was submitted, but check if there were errors
  if ($errors = $form->check($data)) {
    // Inform the user of the errors (or just dump them for now)
    var_dump($errors);
  }else{
    // There were no errors, generate and send the email

    // This following line would usually be dangerous because you allow the
    // user to specify the file path (he could choose any file in the system!)
    // Luckily Phorms will validate that the submitted value was actually one
    // of the options in the dropdown box.
    $body = file_get_contents($data['topic']);

    // Send out an email, the $data['email'] field was required and validated already
    mail($data['email'], 'Hi '.($data['firstname'] ?: 'there'), $body);

    // Choose to exit here, although a 303 redirect is recommended (Post-Redirect-Get pattern)
    print 'We have sent you an email.';
    exit(0);
  }
}

// Render the form, if there were any errors $data includes the entries
$form->render($data);
```

Still to be implemented
-----------------------

[](#still-to-be-implemented)

Phorms was recently extracted from the \[[http://www.snapbill.com\](SnapBill](http://www.snapbill.com](SnapBill) Codebase) and still requires a heavy amount of work.

It is useable as-is (barely) but needs more development before being useful in other codebases.

Further documentation
---------------------

[](#further-documentation)

Documentation or this project is available at:

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/212593?v=4)[Josh Yudaken](/maintainers/qix)[@qix](https://github.com/qix)

---

Top Contributors

[![qix](https://avatars.githubusercontent.com/u/212593?v=4)](https://github.com/qix "qix (34 commits)")

### Embed Badge

![Health badge](/badges/qix-phorms/health.svg)

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

###  Alternatives

[pocketmine/bedrock-data

Blobs of data generated from Minecraft: Bedrock Edition, used by PocketMine-MP

120430.5k8](/packages/pocketmine-bedrock-data)

PHPackages © 2026

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