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

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

slick/form
==========

HTML form manipulation library for slick

v1.3.0(9y ago)12.0k1MITPHP

Since Feb 24Pushed 9y ago1 watchersCompare

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

READMEChangelog (1)Dependencies (12)Versions (5)Used By (1)

Slick Form package
==================

[](#slick-form-package)

[![Latest Version](https://camo.githubusercontent.com/a24ad528491e3906ceac65357878eb7538798ce6501839b8914cb3f9190dcda7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f736c69636b6672616d65776f726b2f666f726d2e7376673f7374796c653d666c61742d737175617265)](https://github.com/slickframework/form/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/f9551023cb1c284a11789328d6b9490f20495e3f7232b2343e3ea7a0d6a01735/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f736c69636b6672616d65776f726b2f666f726d2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/slickframework/form)[![Coverage Status](https://camo.githubusercontent.com/ce5ef9430345fa93729b26023b8ab8c01a9e3fece39998043f218452c7fedcdc/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f736c69636b6672616d65776f726b2f666f726d2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/slickframework/form/code-structure?branch=master)[![Quality Score](https://camo.githubusercontent.com/66ea67d4694360c5bee115115e9339b292aa19b57927b09c68506c11f606beb5/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f736c69636b6672616d65776f726b2f666f726d2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/slickframework/form?branch=master)[![Total Downloads](https://camo.githubusercontent.com/880926d242284cc50ac2a526fa39d652704a33f3cb6520ef31f578eab75039c1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736c69636b2f666f726d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/slick/form)

`Slick/Form` is a package that helps you work with HTML forms. It allows form creation, input validation and filtering and also helps rendering it as HTML in your views. The goal is to create a `Form` object that can be worked in the different stages of an HTTP request.

This package is compliant with PSR-2 code standards and PSR-4 autoload standards. It also applies the [semantic version 2.0.0](http://semver.org) specification.

Install
-------

[](#install)

Via Composer

```
$ composer require slick/form
```

Usage
-----

[](#usage)

One of the greatest features of `Slick/Form` package is to facilitate the creation and usage of HTML forms. You probably will need forms in your application and you will need to create all the HTML for every input, validate that input in submission process and filter the input before using it.

`Slick/Form` helps you with that. All you need is to define your form and its validators and filters and you will have HTML rendering, input validation and filter.

### Form definition

[](#form-definition)

Lets start with a very simple example: A login form (`login-form.yml`)

```
id: login-form
elements:
  username:
    type: text
    label: Username
    validates:
      notEmpty: Username cannot be empty
    filters:
      - text
  password:
    type: password
    label: Password
    validates:
      notEmpty: Password cannot be empty
  remember:
      type: checkbox
      label: Remember me on this computer
      filters:
        - boolean
  buttonGroup:
    type: fieldset
    elements:
      submit:
        type: submit
        value: Sign in
        attributes:
          class: btn btn-primary
```

In your application controller

```
use Slick\Form\FormRegistry;

class LoginController
{
    public function login()
    {
        $form = FormRegistry::getForm('login-form.yml');
        return compact('form');
    }
}
```

### Form HTML rendering

[](#form-html-rendering)

And in your view:

```

    Login form

```

the result should be as follows:

[![Form output](https://raw.githubusercontent.com/slickframework/form/master/img/login-1.png)](https://raw.githubusercontent.com/slickframework/form/master/img/login-1.png)

### Form submission/validation

[](#form-submissionvalidation)

Now with our form in place we need to detect if the form was submitted and if its valid:

```
use Slick\Form\FormRegistry;

class LoginController
{
    public function login()
    {
        $form = FormRegistry::getForm('login-form.yml');
        if ($form->wasSubmitted()) {
            if ($form->isValid()) {
                $data = $form->getValues();  // An associative array with submitted values
                // Do stuff with the values
            } else {
                // data is not valid
            }
        }
        return compact('form');
    }
}
```

The `Form::wasSubmitted()` and `Form::isValid()` methods encapsulate the retrieve of submitted data and the validation process through all input validation chains.

The `Form::getValues()` will return an associative array with submitted values filtered. For example the `$data['remember']` is a `Boolean` value because it will use the `boolean` filter as we set in the `login-form.yml` definitions file.

Testing
-------

[](#testing)

```
$ vendor/bin/phpunit
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Slick framework](https://github.com/slickframework)
- [All Contributors](https://github.com/slickframework/common/graphs/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity66

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

Total

3

Last Release

3388d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/101112?v=4)[fsilva](/maintainers/fsilva)[@fsilva](https://github.com/fsilva)

---

Top Contributors

[![silvamfilipe](https://avatars.githubusercontent.com/u/5720969?v=4)](https://github.com/silvamfilipe "silvamfilipe (13 commits)")

---

Tags

formslickform manipulation

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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