PHPackages                             drw/php-form - 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. drw/php-form

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

drw/php-form
============

This form is use to generate HTML form using PHP

1.1(5y ago)03MITPHP

Since Jul 7Pushed 5y ago1 watchersCompare

[ Source](https://github.com/walegbenga/php-form)[ Packagist](https://packagist.org/packages/drw/php-form)[ Docs](https://github.com/gbengawale/php-form)[ RSS](/packages/drw-php-form/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

As a web programmer, you know form is an integral part of the web(infact, the web engine, almost all we do is based on form). Now, to create a complete form that is not easily hackable, you need to include `csrftoken`, escaping to prevent `XXS attacks`, and the potential complications of handling `one-to-many relationships` they’re really too tedious to code from scratch every time, and, if you forget the csrftoken or a call to htmlspecialchars, you have a security hole. So, I created this `Form plugin` that has methods for many of the elements that a form can contain, and you can easily add additional methods as needed.

*Usage***Installing the plug-in**You can install the plug-in in two ways through

1. composer `composer require drw/php-form`(recommended)
2. You can download the package, extract it and it include or require it

**Supported HTML input type**The supported input types include The `form start`: begins the form and outputs the opening `` tag, with two optional arguments. The first is an array of values to be displayed, indexed by field name. Typically, it’s the` $_POST` array from another form submittal or a row retrieved from the database. The second argument is the action, but almost always you want to go back to the same file. The csrftoken is placed into every form.

`form end` finishes the form. The text method: `text($field, $label/*could be null*/, $len/* default is 50*/, $placeholder/* Could also be null*/, $break/*default is true*/, $password/*this incdicates if the field is password or text*/, $value )`

The label method: `label($field, $label/*the label could be null*/, $break/*break could be true or false*/)`

The button method: `button($field, $label/*The label could be null*/, $break/*default is true but coud also be false)`

The hspace method: `hspace(/*It recieve no parameter*/)`

The checkbox method: `checkbox($field, $label/*this parameter could also be null*/, $break/*break could be true or false*/)`

The radio method: `radio($field, $label/*this parameter could also be null*/, $value, $break/*break could be true or false*/)`

The date plugin `date($field, $label/*this parameter could also be null*/, $break/*break could be true or false*/)`

This is an example of how to use it.

`require __DIR__ . '/path/to/file';// Supposing you use the second method to use this plugin,`

```
$f = new Form();// Start the form
$f->start($row);// It could be null(if the form is new),but if it is prepopulated(then you can include like the example)
$f->hidden('id', $row['id'] ?? '');// The hidden method equates to the hidden input form
$f->text('last', 'Last Name:', 30, 'Last Name');// The text method equates the text input method
$f->text('first', 'First:', 20, 'First Name', false);
$f->text('street', 'Street:', 50, 'Street');
$f->text('city', 'City:', 20, 'City');
$f->text('state', 'State:', 10, 'State', false);
//$f->foreign_key('specialty_id', 'name', 'Specialty');
$f->radio('billing', 'Monthly', 'month');
$f->hspace(2);// Use to add 2 horizontal spaces to the form
$f->radio('billing', 'Yearly', 'year', false);
$f->hspace(2)// Use to add 2 horizontal spaces to the form;
$f->radio('billing', 'Recurring', 'recurring', false);
$f->menu('contact', 'Contact:',
array('phone', 'email', 'mail', 'none'), true, 'email');// This is use to add drop down menu
$f->checkbox('premium', 'Premium:', false);// THis is use to add checkbox to the form
$f->date('since', 'Member Since:', false); // This is use to add dater to the form
$f->button('action_save', 'Save');// This is use to add button to the form
$f->end();// This is use to end the form

```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% 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 ~8 days

Total

2

Last Release

2132d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d511a0de745b78a6ff2c189c3c0d38cca7fcaa08686b2317c2eb76583ed04b08?d=identicon)[walegbenga](/maintainers/walegbenga)

---

Top Contributors

[![gbengasupowale](https://avatars.githubusercontent.com/u/48821090?v=4)](https://github.com/gbengasupowale "gbengasupowale (6 commits)")[![walegbenga](https://avatars.githubusercontent.com/u/20439132?v=4)](https://github.com/walegbenga "walegbenga (1 commits)")

---

Tags

phpwebformform generatorhtml-formphp-form-generatorform-library

### Embed Badge

![Health badge](/badges/drw-php-form/health.svg)

```
[![Health](https://phpackages.com/badges/drw-php-form/health.svg)](https://phpackages.com/packages/drw-php-form)
```

PHPackages © 2026

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