PHPackages                             pinkcrab/form\_fields - 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. pinkcrab/form\_fields

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

pinkcrab/form\_fields
=====================

A simple form field creator ideal for wp-admin hook calls where a simple input is needed only as html.

0.1.8(4y ago)1244[1 issues](https://github.com/Pink-Crab/Form-Fields/issues)1MITPHPPHP &gt;=7.1.0

Since Jan 14Pushed 4y agoCompare

[ Source](https://github.com/Pink-Crab/Form-Fields)[ Packagist](https://packagist.org/packages/pinkcrab/form_fields)[ Docs](https://pinkcrab.co.uk)[ RSS](/packages/pinkcrab-form-fields/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (9)Dependencies (13)Versions (24)Used By (1)

PinkCrab Form Fields
====================

[](#pinkcrab-form-fields)

[![alt text](https://camo.githubusercontent.com/eb442aa5c5c68e0b728bb194033982547fd3cadfa30be143ae1967898c91d916/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f43757272656e745f56657273696f6e2d302e312e382d79656c6c6f772e7376673f7374796c653d666c6174 " ")](https://camo.githubusercontent.com/eb442aa5c5c68e0b728bb194033982547fd3cadfa30be143ae1967898c91d916/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f43757272656e745f56657273696f6e2d302e312e382d79656c6c6f772e7376673f7374796c653d666c6174)[![Open Source Love](https://camo.githubusercontent.com/2d4eac62d5f5830a5309100b88e0ecccb171aee1fbcd794149f4a580b0010c56/68747470733a2f2f6261646765732e66726170736f66742e636f6d2f6f732f6d69742f6d69742e7376673f763d313032)](https://github.com/ellerbrock/open-source-badge/)[![](https://github.com/Pink-Crab/Form-Fields/workflows/GitHub_CI/badge.svg " ")](https://github.com/Pink-Crab/Form-Fields/workflows/GitHub_CI/badge.svg)[![codecov](https://camo.githubusercontent.com/c340ec447f9f11c542b1ec7b83d7d6538710edecb32b4227840cd9d2b41e0aba/68747470733a2f2f636f6465636f762e696f2f67682f50696e6b2d437261622f466f726d2d4669656c64732f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d5a453134304e424e5047)](https://codecov.io/gh/Pink-Crab/Form-Fields)

A simple way of parsing html5 form elements. Not a comprensive package, just enough to render most fields in wp-admin.

### Installation

[](#installation)

To install from composer please run

```
composer require pinkcrab/form_fields
```

### Basic Usage

[](#basic-usage)

To create a simple form field and render(print) it to the screen

```
Input_Text::create( 'my_input' )
    ->current( get_option( 'my_option', 'fallback' ) )
    ->render();
```

[![](/docs/assets/simple_input.png)](/docs/assets/simple_input.png)[![](/docs/assets/basic_input_with_current.png)](/docs/assets/basic_input_with_current.png)

You can return the HTML string of the input using as\_*string*()

```
Input_Text::create( 'my_input' )
    ->current( MyData::getOption( 'my_option', 'fallback' ) )
    ->as_string();
```

[![](/docs/assets/simple_input_html.png)](/docs/assets/simple_input_html.png)

### Field Types

[](#field-types)

- [Text](/docs/input_text.md)
- Search
- Password
- Email
- URL
- Tel
- Number
- Range
- Text Area
- Date
- Date Time
- Checkbox (Single &amp; Group)
- Radio
- Select
- Raw HTML
- Hidden
- Week
- Month
- Image (button)
- Submit

All inputs are extended from the Abstract\_Field class and have all the functionality laid out in the Base Field section.

Labels

### Output

[](#output)

Each form field is preloaded with a parser which can either render the input field or return the HTML. If you create your own field, you can make use of our existing parsers or create your own, using the Parser interface.

```
Input_Text::create('test')->render()    // Prints the input
Input_Text::create('test')->as_string() // Returns as HTML string.
```

### Field Creation

[](#field-creation)

All of our Form Fields has protected `__construct`'ors and need to be created using the **create()** named constructor.

```
Input_Text::create('name')->render();
Input_Email::create('email')->render();
Input_Password::create('password')->render();
```

Version
-------

[](#version)

**Release 0.1.7**

Change Log
----------

[](#change-log)

- 0.1.8 - Label is now auto shown if length is above 0 and hidden if 0.
- 0.1.7 - Added in missing URL field, also all tests cleaned up and all attributes are now just controlled by attributes, not custom properties. Added in the Datalist attribute to all valid input fields. Tests extended running over 1500 assertions
- 0.1.6 - Added in missing fields \[ Colour(inc alias Color), Week, Time, Month, File, Image, Submit &amp; Tel \] and moved to a new abstract INPUT which is used to extend all &lt;INPUT&gt; fields from a base abstract input. Tests cleaned up and all attributes are now just controlled by attributes, not custom properties.
- 0.1.5 - Allow numerical strings for select options.
- 0.1.4 - Removed default as not implemented and not really suitable for this library. Also included the option to set custom name attributes to fields, falling back to the key (id) if not set.
- 0.1.3 - Added in the Checkbox Group field
- 0.1.2 - Various bug fixes
- 0.1.1 - Various bug fixes

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity48

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 ~49 days

Recently: every ~56 days

Total

10

Last Release

1501d ago

### Community

Maintainers

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

---

Top Contributors

[![gin0115](https://avatars.githubusercontent.com/u/28779094?v=4)](https://github.com/gin0115 "gin0115 (111 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/pinkcrab-form-fields/health.svg)

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

###  Alternatives

[spatie/laravel-personal-data-export

Create personal data downloads in a Laravel app

550543.8k8](/packages/spatie-laravel-personal-data-export)[kodicomponents/navigation

The KodiCMS Support package.

12232.6k10](/packages/kodicomponents-navigation)

PHPackages © 2026

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