PHPackages                             laasti/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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. laasti/form

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

laasti/form
===========

v0.2.2(10y ago)0298[1 PRs](https://github.com/laasti/form/pulls)MITPHP

Since Sep 9Pushed 9y ago1 watchersCompare

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

READMEChangelog (5)DependenciesVersions (7)Used By (0)

Laasti/form
===========

[](#laastiform)

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

[](#installation)

```
composer require laasti/form

```

Usage
-----

[](#usage)

Forms have groups containing multiple fields.

```
$form = new Laasti\Form\Form($data, $errors, $rules);
$form->setMethod('post'); //Defaults to post
$form->setAction('url');
$form->setAttributes([/*html attributes*/]);
$form->addField('text', 'field', 'Label', [/*choices*/], 'group', [/*input attributes*/], [/*row attributes*/]);
$form->removeField('field');
$form->removeGroup('group');
$form->setGroup('field', 'group');
$form->setLabel('field', 'Label');
$form->setType('field', 'type');
$form->setAttributes('field', [/*attributes*/]);
$form->setContainerAttributes('field', [/*attributes*/]);
$form->setData([]);
$form->setErrors([]);
$form->setRules([]);
$form->setGroupsLayout([
    'top',
    'main' => ['column1', 'column2'],
    'secondary' => ['side', 'wide'],
    'multi-level' => [
        'subsection' => ['sub-column1', 'sub-column2'],
        'subsection2'
    ]
]);
$form->defineGroup('group', 'Title', [/*attributes*/]);
```

Then in your view:

```
$form->getAction(); //Get form action attribute
$form->getMethod(); //Get form method
$form->getFormAttributes(); //Get form attributes
$form->getAllFields(); //All fields without groups
$form->getFields(); //Just fields without groups
$group = array_shift($form->getGroups()); //Array of first level groups
$group->getLabel();
$group->getAttributes();
$group->getGroups(); //Array of subgroups
$field = array_shift($group->getFields()); //Array of fields in group
$field->getLabel();
$field->getName();
$field->getGroup();
$field->getChoices();
$field->getAttributes();
$field->getContainerAttributes();

//OR you can use magic properties instead of lengthy getters in views
$field->choices;
$field->containerAttributes;

//There are some magic properties as well
$field->isRequired;//Checks if required exists in $field->attributes
$field->is{Name};//If you want to identify a field by its name
$field->is{Type};//If you want to check a field's type
```

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

[](#contributing)

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D

History
-------

[](#history)

See CHANGELOG.md for more information.

Credits
-------

[](#credits)

Author: Sonia Marquette (@nebulousGirl)

License
-------

[](#license)

Released under the MIT License. See LICENSE.txt file.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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

Total

5

Last Release

3855d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/48bb7fdba3e642d3dc668b9ff03ff949b9043f58096f3c85c13de508b53e7d68?d=identicon)[nebulousGirl](/maintainers/nebulousGirl)

---

Top Contributors

[![nebulousGirl](https://avatars.githubusercontent.com/u/1899256?v=4)](https://github.com/nebulousGirl "nebulousGirl (20 commits)")

### Embed Badge

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

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

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

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