PHPackages                             pinkcrab/form-components - 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. [Templating &amp; Views](/categories/templating)
4. /
5. pinkcrab/form-components

ActiveLibrary[Templating &amp; Views](/categories/templating)

pinkcrab/form-components
========================

Collection of View Components for the Perique framework. Is used to render form fields.

2.1.5(1mo ago)1596[1 issues](https://github.com/Pink-Crab/Perique-Form-Components/issues)[2 PRs](https://github.com/Pink-Crab/Perique-Form-Components/pulls)1MITPHPPHP &gt;=8.0.0CI passing

Since Apr 13Pushed 2w agoCompare

[ Source](https://github.com/Pink-Crab/Perique-Form-Components)[ Packagist](https://packagist.org/packages/pinkcrab/form-components)[ Docs](https://pinkcrab.co.uk)[ RSS](/packages/pinkcrab-form-components/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (6)Dependencies (18)Versions (25)Used By (1)

[![logo](docs/form-components-logo.png "PinkCrab Perique Form Components")](docs/form-components-logo.png)

Perique - Form Components
=========================

[](#perique---form-components)

A collection of View Components for rendering form fields in the Perique Framework. Build forms with a fluent PHP API, automatic HTML rendering, built-in sanitization and validation.

[![Latest Stable Version](https://camo.githubusercontent.com/a1d97d164af86b333cc2cce92065d67a4afe1769a755d1c109e53481eed6eca3/68747470733a2f2f706f7365722e707567782e6f72672f70696e6b637261622f666f726d2d636f6d706f6e656e74732f76)](https://packagist.org/packages/pinkcrab/form-components) [![Total Downloads](https://camo.githubusercontent.com/cfcb766011e0a11ea0525dd52a78a6fa6c0695c689a5447129000463f0db2173/68747470733a2f2f706f7365722e707567782e6f72672f70696e6b637261622f666f726d2d636f6d706f6e656e74732f646f776e6c6f616473)](https://packagist.org/packages/pinkcrab/form-components) [![Latest Unstable Version](https://camo.githubusercontent.com/6a5c77480e28b17a4d84eecf092003649be0de7f40c8d4c6f217284e080ea44e/68747470733a2f2f706f7365722e707567782e6f72672f70696e6b637261622f666f726d2d636f6d706f6e656e74732f762f756e737461626c65)](https://packagist.org/packages/pinkcrab/form-components) [![License](https://camo.githubusercontent.com/7c66e3040824fa90c456ab5d716b7de0db4dbbdd23cd1f922fb5776c3c31b3ff/68747470733a2f2f706f7365722e707567782e6f72672f70696e6b637261622f666f726d2d636f6d706f6e656e74732f6c6963656e7365)](https://packagist.org/packages/pinkcrab/form-components) [![PHP Version Require](https://camo.githubusercontent.com/b0fd327f312dfb6bd074928a2b8fdf5c2bd3fda1997e0514c115fe0943bd0f09/68747470733a2f2f706f7365722e707567782e6f72672f70696e6b637261622f666f726d2d636f6d706f6e656e74732f726571756972652f706870)](https://packagist.org/packages/pinkcrab/form-components)[![GitHub contributors](https://camo.githubusercontent.com/57d4ce66892a47e445d574fea38090168b8ea736be56c7e40eafa197b3ebfc9a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f50696e6b2d437261622f506572697175652d466f726d2d436f6d706f6e656e74733f6c6162656c3d436f6e7472696275746f7273)](https://camo.githubusercontent.com/57d4ce66892a47e445d574fea38090168b8ea736be56c7e40eafa197b3ebfc9a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f50696e6b2d437261622f506572697175652d466f726d2d436f6d706f6e656e74733f6c6162656c3d436f6e7472696275746f7273)[![GitHub issues](https://camo.githubusercontent.com/2835af356de4a7a5f73188a5a1ee2425c4ea08ba4b5eda94be6a71385aed1e4f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d7261772f50696e6b2d437261622f506572697175652d466f726d2d436f6d706f6e656e7473)](https://camo.githubusercontent.com/2835af356de4a7a5f73188a5a1ee2425c4ea08ba4b5eda94be6a71385aed1e4f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d7261772f50696e6b2d437261622f506572697175652d466f726d2d436f6d706f6e656e7473)[![WordPress 6.6 Test Suite [PHP8.0-8.4]](https://github.com/Pink-Crab/Perique-Form-Components/actions/workflows/WP_6_6.yaml/badge.svg)](https://github.com/Pink-Crab/Perique-Form-Components/actions/workflows/WP_6_6.yaml)[![WordPress 6.7 Test Suite [PHP8.0-8.4]](https://github.com/Pink-Crab/Perique-Form-Components/actions/workflows/WP_6_7.yaml/badge.svg)](https://github.com/Pink-Crab/Perique-Form-Components/actions/workflows/WP_6_7.yaml)[![WordPress 6.8 Test Suite [PHP8.0-8.4]](https://github.com/Pink-Crab/Perique-Form-Components/actions/workflows/WP_6_8.yaml/badge.svg)](https://github.com/Pink-Crab/Perique-Form-Components/actions/workflows/WP_6_8.yaml)[![WordPress 6.9 Test Suite [PHP8.0-8.4]](https://github.com/Pink-Crab/Perique-Form-Components/actions/workflows/WP_6_9.yaml/badge.svg)](https://github.com/Pink-Crab/Perique-Form-Components/actions/workflows/WP_6_9.yaml)[![E2E Tests (Playwright)](https://github.com/Pink-Crab/Perique-Form-Components/actions/workflows/E2E.yaml/badge.svg)](https://github.com/Pink-Crab/Perique-Form-Components/actions/workflows/E2E.yaml)[![codecov](https://camo.githubusercontent.com/3f5868f8901c3e431c3caca767caadf17e5b6c188b0322872bffe58d994e037a/68747470733a2f2f636f6465636f762e696f2f67682f50696e6b2d437261622f506572697175652d466f726d2d436f6d706f6e656e74732f67726170682f62616467652e7376673f746f6b656e3d68647272766e67387076)](https://codecov.io/gh/Pink-Crab/Perique-Form-Components)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/615d88fbb1ae6bdbf8e9c8cababb34ae79313ba2cfaf6e5589b8cb90c5681115/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f50696e6b2d437261622f506572697175652d466f726d2d436f6d706f6e656e74732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Pink-Crab/Perique-Form-Components/?branch=master)

---

Setup
-----

[](#setup)

```
$ composer require pinkcrab/form-components
```

Register the module in your Perique bootstrap:

```
use PinkCrab\Form_Components\Module\Form_Components;

( new App_Factory() )
    ->default_setup()
    ->module( Form_Components::class )
    ->boot();
```

---

Quick Start
-----------

[](#quick-start)

Render fields in any Perique view template:

```
use PinkCrab\Form_Components\Component\Field\Input_Component;
use PinkCrab\Form_Components\Element\Field\Input\Text;

$this->component( new Input_Component(
    Text::make( 'username' )
        ->label( 'Username' )
        ->placeholder( 'Enter your username' )
        ->required( true )
) );
```

Or use the `Make` helper for a more concise syntax:

```
use PinkCrab\Form_Components\Util\Make;

$this->component( Make::text( 'username', fn( $f ) => $f
    ->label( 'Username' )
    ->placeholder( 'Enter your username' )
    ->required( true )
) );
```

### Building a Complete Form

[](#building-a-complete-form)

```
use PinkCrab\Form_Components\Util\Make;
use PinkCrab\Form_Components\Element\Field\Input\{Text, Email, Tel, Hidden};
use PinkCrab\Form_Components\Element\Field\{Select, Textarea};
use PinkCrab\Form_Components\Element\Field\Group\Radio_Group;
use PinkCrab\Form_Components\Element\{Fieldset, Form, Nonce, Button, Raw_HTML};

$this->component( Make::form( 'enquiry', fn( $f ) => $f
    ->method( 'POST' )
    ->action( '/submit' )
    ->fields(
        // Raw HTML for intro text
        Raw_HTML::make( 'intro' )
            ->html( 'Fill in the form below and we will get back to you.' ),

        // Fieldset groups related fields
        Fieldset::make( 'personal' )
            ->legend( 'Your Details' )
            ->fields(
                Text::make( 'name' )->label( 'Name' )->required( true ),
                Email::make( 'email' )->label( 'Email' )->required( true ),
                Tel::make( 'phone' )->label( 'Phone' )->placeholder( '+44 7700 900000' )
            ),

        // Select and radio group
        Select::make( 'subject' )
            ->label( 'Subject' )
            ->options( array(
                ''        => 'Select...',
                'sales'   => 'Sales Enquiry',
                'support' => 'Support',
                'other'   => 'Other',
            ) )
            ->required( true ),

        Radio_Group::make( 'priority' )
            ->label( 'Priority' )
            ->options( array(
                'low'    => 'Low',
                'medium' => 'Medium',
                'high'   => 'High',
            ) )
            ->selected( 'medium' ),

        Textarea::make( 'message' )
            ->label( 'Message' )
            ->rows( 5 )
            ->required( true ),

        // Hidden field and nonce for security
        Hidden::make( 'form_id' )->set_existing( 'enquiry-v1' ),
        Nonce::make( 'submit_enquiry', '_enquiry_nonce' ),

        Button::make( 'submit' )->type( 'submit' )->text( 'Send Enquiry' )
    )
) );
```

Generated HTML```

    Fill in the form below and we will get back to you.

        Your Details

            Name

            Email

            Phone

        Subject

            Select...
            Sales Enquiry
            Support
            Other

        Priority

             Low

             Medium

             High

        Message

        Send Enquiry

```

---

Field Types
-----------

[](#field-types)

### Text Inputs

[](#text-inputs)

FieldClassMake HelperDocsText`Input\Text``Make::text()`[View](docs/fields/text.md)Email`Input\Email``Make::email()`[View](docs/fields/email.md)Password`Input\Password``Make::password()`[View](docs/fields/password.md)Search`Input\Search``Make::search()`[View](docs/fields/search.md)Tel`Input\Tel``Make::tel()`[View](docs/fields/tel.md)URL`Input\Url``Make::url()`[View](docs/fields/url.md)### Numeric Inputs

[](#numeric-inputs)

FieldClassMake HelperDocsNumber`Input\Number``Make::number()`[View](docs/fields/number.md)Range`Input\Range``Make::range()`[View](docs/fields/range.md)### Date &amp; Time Inputs

[](#date--time-inputs)

FieldClassMake HelperDocsDate`Input\Date``Make::date()`[View](docs/fields/date.md)Time`Input\Time``Make::time()`[View](docs/fields/time.md)Datetime`Input\Datetime``Make::datetime()`[View](docs/fields/datetime.md)Month`Input\Month``Make::month()`[View](docs/fields/month.md)Week`Input\Week``Make::week()`[View](docs/fields/week.md)### Special Inputs

[](#special-inputs)

FieldClassMake HelperDocsColor`Input\Color``Make::color()`[View](docs/fields/color.md)File`Input\File``Make::file()`[View](docs/fields/file.md)Hidden`Input\Hidden``Make::hidden()`[View](docs/fields/hidden.md)Checkbox`Input\Checkbox``Make::checkbox()`[View](docs/fields/checkbox.md)Radio`Input\Radio``Make::radio()`[View](docs/fields/radio.md)### Selection Groups

[](#selection-groups)

FieldClassMake HelperDocsSelect`Field\Select``Make::select()`[View](docs/fields/select.md)Checkbox Group`Group\Checkbox_Group``Make::checkbox_group()`[View](docs/fields/checkbox-group.md)Radio Group`Group\Radio_Group``Make::radio_group()`[View](docs/fields/radio-group.md)### Other Elements

[](#other-elements)

ElementClassMake HelperDocsTextarea`Field\Textarea``Make::textarea()`[View](docs/fields/textarea.md)Button`Element\Button``Make::button()`[View](docs/fields/button.md)Form`Element\Form``Make::form()`[View](docs/fields/form.md)Fieldset`Element\Fieldset``Make::fieldset()`[View](docs/fields/fieldset.md)Custom Field`Element\Custom_Field``Make::custom()`[View](docs/fields/custom-field.md)---

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

[](#change-log)

- 2.1.5 - Field templates no longer pass a `null` `before_field` / `after_field` to `wp_kses_post()` when `before()` / `after()` weren't called — the strict empty-string check introduced in 2.1.4 didn't account for the unset (null) case, which triggered a `preg_replace(): Passing null` deprecation on PHP 8.1+. Fixed by checking for both null and empty string. (Issue #25)
- 2.1.4 - Field names containing PHP-style brackets (e.g. `wm_loc_coordinates[0][latlong]`) and case-sensitive characters are now preserved verbatim rather than being mangled by `sanitize_title()`. `before()` / `after()` adornments now render whether `show_wrapper(false)` or `show_wrapper(true)` is set — they were previously dropped when the wrapper was off. (Issue #23) \*2.1.3 - Adds description pre and post fields within the field wrapper.
- 2.1.2 - Fixed label/input accessibility, wrapper class duplication and unnecessary `list` attribute rendering.
- 2.1.1 - Added Custom\_Field element for rendering arbitrary HTML with full field treatment (wrapper, label, notifications, configurable kses filtering)
- 2.1.0 - Initial release for Perique 2.1.\*

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance75

Regular maintenance activity

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

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

Total

6

Last Release

36d 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 (59 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3861.2M](/packages/limenius-react-bundle)[wmde/php-vuejs-templating

PHP implementation of Vue.js templating engine

3041.6k2](/packages/wmde-php-vuejs-templating)[jelix/wikirenderer

WikiRenderer is a library to generate HTML or anything else from wiki content.

1712.2k1](/packages/jelix-wikirenderer)[webkinder/sproutset

A Composer package for handling responsive images in Roots Bedrock + Sage + Blade projects.

291.8k](/packages/webkinder-sproutset)

PHPackages © 2026

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