PHPackages                             mvccore/ext-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. [Framework](/categories/framework)
4. /
5. mvccore/ext-form

ActiveLibrary[Framework](/categories/framework)

mvccore/ext-form
================

MvcCore - Extension - Form - form extension with base classes to create and render web forms with HTML5 controls, to handle and validate submited user data, to manage forms sessions for default values, to manage user input errors and to extend and develop custom fields and field groups.

v5.3.4(8mo ago)14.3k117BSD-3-ClausePHPPHP &gt;=5.4.0

Since Jan 5Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/mvccore/ext-form)[ Packagist](https://packagist.org/packages/mvccore/ext-form)[ RSS](/packages/mvccore-ext-form/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (1)Versions (101)Used By (17)

MvcCore - Extension - Form
==========================

[](#mvccore---extension---form)

[![Latest Stable Version](https://camo.githubusercontent.com/2c7e121f1bccbfa0894e4e6a2f8bd54b6ff1f9d88b20b1c94b7c4331c63eb08a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f537461626c652d76352e332e352d627269676874677265656e2e7376673f7374796c653d706c6173746963)](https://github.com/mvccore/ext-form/releases)[![License](https://camo.githubusercontent.com/53baed538c1c87a033a212f6f4acce684d36137f8622307643ab25e08118452e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d425344253230332d627269676874677265656e2e7376673f7374796c653d706c6173746963)](https://mvccore.github.io/docs/mvccore/5.0.0/LICENSE.md)[![PHP Version](https://camo.githubusercontent.com/9e923690739211296a00adce5d359999dfa345f80fc1b2e2cfe72c49523ee334/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d2533453d352e342d627269676874677265656e2e7376673f7374796c653d706c6173746963)](https://camo.githubusercontent.com/9e923690739211296a00adce5d359999dfa345f80fc1b2e2cfe72c49523ee334/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d2533453d352e342d627269676874677265656e2e7376673f7374796c653d706c6173746963)

**THIS IS NOT PACKAGE WITH ALL FORM FIELD CLASSES!
IF YOU JUST WANT TO CREATE A FORM VERY QUICKLY,
USE PACKAGE [`mvccore/ext-form-all`](https://github.com/mvccore/ext-form-all) INSTEAD WITH ALL FORM FIELDS AND VALIDATORS!**

MvcCore extension with base form and field classes to create and render web forms with HTML5 controls, to handle and validate submited user data, to manage forms sessions for default values, to manage user input errors and to extend and develop custom fields and field groups.

This package can not exist alone without any form field extension(s) like: `mvccore/ext-form-field-*`to have possiblity to create specific field(s) in youf form instance. If you want to use all fields and validators, use extension [`mvccore/ext-form-all`](https://github.com/mvccore/ext-form-all) instead of `mvccore/ext-form`. This extension is only part of whole thing to not have too much field classes code in small aplications.

Installation
------------

[](#installation)

```
composer require mvccore/ext-form
```

Than you need install any form field extension bellow like: `mvccore/ext-form-field-*`

```
composer require mvccore/ext-form-field-text
```

### Form Extensible Packages Map

[](#form-extensible-packages-map)

- [`mvccore/ext-form-all`](https://github.com/mvccore/ext-form-all) - Main huge extension with all subextensions to render web forms, handle
     submits, managing fields, sessions and errors, extension with all form packages.
- `mvccore/ext-form` - Form extension with only base form and field classes.
- [`mvccore/ext-form-field-text`](https://github.com/mvccore/ext-form-field-text) - Fields extension with input field types text, email, password, search, tel, url and textarea.
- [`mvccore/ext-form-field-numeric`](https://github.com/mvccore/ext-form-field-numeric) - Fields extension with input field types number and range.
- [`mvccore/ext-form-field-selection`](https://github.com/mvccore/ext-form-field-selection) - Fields extension with fields select, country select, checkbox(es), radios and color.
- [`mvccore/ext-form-field-date`](https://github.com/mvccore/ext-form-field-date) - Fields extension with input field types date, datetime, time, week and month.
- [`mvccore/ext-form-field-button`](https://github.com/mvccore/ext-form-field-button) - Fields extension with button fields and input submit fields.
- [`mvccore/ext-form-field-file`](https://github.com/mvccore/ext-form-field-file) - Fields extension with input type file(s) with upload validation.
- [`mvccore/ext-form-validator-special`](https://github.com/mvccore/ext-form-validator-special) - Validators only extension with special text and numeric validators.

Main Features
-------------

[](#main-features)

- create dynamic forms with variable assigned fields
- All HTML5 fields and atributes
- build in validator in every field by it's type
- automatic/customizable CSRF and XSS protection
- managing error messagess in session
- rendefing forms by default or by it's template
- rendefing any custom or build-in field by default or by it's template
- very extensible form class and field classes
- very extensible supporting javascripts for any fields
- translations, session data management
- different/custom result states for multiple submit buttons

### Fields

[](#fields)

- build in fields in `mvccore/ext-form`:
    - base `Field` and `FieldsGroup` clases to extend any control with your custom functionality
    - `input:hidden`
    - `datalist`
- extended text fields in [`mvccore/ext-form-field-text`](https://github.com/mvccore/ext-form-field-text):
    - `input:text`, `:password`, `:email`, `:search`, `:tel`, `:url`
    - `textarea`
- extended numeric fields in [`mvccore/ext-form-field-numeric`](https://github.com/mvccore/ext-form-field-numeric):
    - `input:number`, `:range` (slider) and multiple `input:range`
- extended selection fields in [`mvccore/ext-form-field-selection`](https://github.com/mvccore/ext-form-field-selection):
    - `select` (multi select)
    - country `select`
    - `input:checkbox`
    - `input:checkbox` group
    - `input:radio` (radio button, switch)
    - `input:color`
- extended date fields in [`mvccore/ext-form-field-date`](https://github.com/mvccore/ext-form-field-date):
    - `input:date`
    - `input:datetime-local`
    - `input:time`
    - `input:week`
    - `input:month`
- extended button fields in [`mvccore/ext-form-field-button`](https://github.com/mvccore/ext-form-field-button):
    - `input:button`
    - `input:reset`
    - `input:submit`
    - `input:image`
    - `button:button`
    - `button:reset`
    - `button:submit`
- extended file field in [`mvccore/ext-form-field-file`](https://github.com/mvccore/ext-form-field-file):
    - `input:file` with multiple option and validation

### Validators

[](#validators)

Each form control has always naturaly configured validator(s) by type.

- build in validators in every field and in `mvccore/ext-form`:
    - required, readOnly, disabled...
    - safe string (keep characters to safely display submitted value in response - XSS protection)
- extended text fields in [`mvccore/ext-form-field-text`](https://github.com/mvccore/ext-form-field-text):
    - email - to check if email(s) is/are valid form or not
    - min. and max. text length
    - password - to check password strength by configured rules
    - pattern - PHP preg\_match by `pattern` control attribute
    - url (to check if string is url or not)
    - tel (only to clean not allowed chars in phone number)
    - ZIP code (to check international ZIP code form)
- extended numeric fields in [`mvccore/ext-form-field-numeric`](https://github.com/mvccore/ext-form-field-numeric):
    - number (integer or float, min., max. and step)
    - range (min., max. and step)
- extended selection fields in [`mvccore/ext-form-field-selection`](https://github.com/mvccore/ext-form-field-selection):
    - checkbox - checked
    - value in options (check if submitted value exists in options or not, for selects, country selects, checkbox group and radios)
    - min./max. options selected
    - hexadecimal non-transparent color
- extended date fields in [`mvccore/ext-form-field-date`](https://github.com/mvccore/ext-form-field-date):
    - date - if date has correct format and check min. max. and step
    - datetime, time, week and month validators are extended from date validator
- extended file field in [`mvccore/ext-form-field-file`](https://github.com/mvccore/ext-form-field-file)
    - files validator to check everything possible in uploaded file(s) (by magic bytes and more)
- extended special validators in [`mvccore/ext-form-validator-special`](https://github.com/mvccore/ext-form-validator-special)
    - EU company ID/VAT ID
    - credit card (only checking number checksum)
    - iban bank account number (only checking number checksum)
    - hexadecimal number
    - IP address (IPv4 and IPV6 format checking)
    - international ZIP code format checking

### All About Features

[](#all-about-features)

- creates, renders and submits dynamicly created web forms without needs to specify any static model class for form model (like in classic .NET MVC forms)
- implemented all HTML5 form attributes, all HTML5 fields and their HTML5 and older atributes
- every field has it's build-in default validator and it's possible to define any other or all field validators by you
- automatic/customizable CSRF and XSS protection
    - every form (GET/POST) has it's own cross site request forgery (CSRF) hidden input with token name and token value to check if form was submitted by specific user session and not by any foreing atacker javascript code
    - possiblity to manage CSRF protection by your own
    - all field where is possible to pass dangerous characters for XSS attack are protected by validator for XSS safe string by default. It's possible to remove this validator and implement it's own protection
- error messages - stored in session only for one form submit, rendered automaticly
- templates rendering automaticly or by custom template
    - naturaly rendered form has each control in empty div
    - rendered custom template shoud have any content and CSRF tokens are creted automaticly by `$form->RenderFormBegin();`
    - any complex form control could have also it's own custom template
    - any form or control template has automaticly asigned properties from it's local `$this` context and original `$controller->View` from controller passed into form `__construct();` is asigned into `$this->View`.
- possibility to extend form itself, any field, field group or validator, you can use build-in interfaces, abstract classes and traits
- custom js/css assets for any field type
    - possible to render immediately after form HTML body (by default)
    - possible to render as external linked file by custom renderer or custom response appending script/solution
    - posibility to extend build-in javascripts by checkout and extend: "[**mvccore/ext-form-js**](https://github.com/mvccore/ext-form-js)"
- translations, session data management
    - every visible form shoud be translated by configured translator callable into form instance
    - loading default values or previous submit values from session
    - possible to optionally clear session after submitting
- different/custom result states for multiple submit buttons
    - declarating error url, success url (previous and next step url for special developer implementations)
    - possibility to define for any submit button custom form result state to recognize what to do next
- form have build-in language property (for translator) and locale property for advanced fields and validators

Examples
--------

[](#examples)

- [**Example - CD Collection (mvccore/example-cdcol)**](https://github.com/mvccore/example-cdcol)
- [**Application - Questionnaires (mvccore/app-questionnaires)**](https://github.com/mvccore/app-questionnaires)

Basic Example
-------------

[](#basic-example)

### Form Initialization At 'Contact:Default' Route:

[](#form-initialization-at-contactdefault-route)

```
$form = (new \MvcCore\Ext\Form($mvcCoreController))
	->SetId('newsletter')
	->SetAction(
		$mvcCoreController->Url('Contact:Submit')
	)
	->SetSuccessUrl(
		$mvcCoreController->Url('Contact:Submitted')
	)
	->SetErrorUrl(
		$mvcCoreController->Url('Contact:Default')
	);
$email = (new \MvcCore\Ext\Form\Email)
	->SetName('mail')
	->SetLabel('Your email:')
	->SetRequired();
$submit = (new \MvcCore\Ext\Form\SubmitButton)
	->SetName('submit')
	->SetValue('Send');
$form->AddFields($email, $submit);
$mvcCoreController->view->newsletterForm = $form;
```

### Form Rendering In Template At 'Contact:Default' Route:

[](#form-rendering-in-template-at-contactdefault-route)

```

```

### Form Submitting At 'Contact:Submit' Route:

[](#form-submitting-at-contactsubmit-route)

```
// ... form initialization again into var: $form

// process all configured validators by: $form->Submit();
list($result, $data, $errors) = $form->Submit();

// if data has been submitted successfuly,
// store user email somewhere in database:
if ($result == \MvcCore\Ext\Form::RESULT_SUCCESS) {
	// store user email somewhere by any custom model class (User):
	(new User())->SetEmail($data['mail'])->Save();
	// clear form session space to not display filled
	// data by current user to another users
	$form->ClearSession();
}

// redirect user to configured success
// or error url (by internal $form->Result property):
$form->SubmittedRedirect();
```

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance78

Regular maintenance activity

Popularity20

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity74

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

Recently: every ~70 days

Total

100

Last Release

255d ago

Major Versions

v1.0.1 → v2.0.02017-01-05

v2.0.0 → v3.0.02017-01-14

v3.2.2 → v4.0.02017-01-29

v4.3.1 → v5.0.02021-01-18

PHP version history (2 changes)v1.0.0PHP &gt;=5.3.0

v5.0.0PHP &gt;=5.4.0

### Community

Maintainers

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

---

Top Contributors

[![tomFlidr](https://avatars.githubusercontent.com/u/1833722?v=4)](https://github.com/tomFlidr "tomFlidr (512 commits)")

---

Tags

urlpluginsearchframeworkimageemailHTML5datetimecolorfiletimedatetextmvcextensionplug-ingroupsformfieldinputtextareaselectfieldsbuttonFormsnumberdynamicextrangecheckboxtelMonthinputsresetradioweekwebformmvccore

### Embed Badge

![Health badge](/badges/mvccore-ext-form/health.svg)

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

PHPackages © 2026

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