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

ActiveLibrary[Framework](/categories/framework)

reioto/form-object
==================

Web Form Framework

1.0.0(10y ago)011BSD-3-ClausePHPPHP &gt;=5.3.3

Since Dec 2Pushed 10y ago1 watchersCompare

[ Source](https://github.com/reioto/form-object)[ Packagist](https://packagist.org/packages/reioto/form-object)[ RSS](/packages/reioto-form-object/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

form-object
===========

[](#form-object)

[![Build Status](https://camo.githubusercontent.com/d0aafd28f59af6c5c624bcbcbcb5632905bbaaa0d53d3e9910f0e3928a69f71e/68747470733a2f2f7472617669732d63692e6f72672f7265696f746f2f666f726d2d6f626a6563742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/reioto/form-object)

FormObject is freely form library

How to use it?
--------------

[](#how-to-use-it)

```
//Define Data class for Form
class FooData extends \FormObject\Data
{
    //Item's initializing value
    public $name = '';
    public $email = '';
    public function getFooSelect()
    {
       return array('itemA', 'itemB', 'itemC');
    }
}

//Define Form class
class FooForm extends \FormObject\Base
{
    public function execute()
    {
       //validate
       //filtering
       //etc...
       return true;
    }
}

$data = new FooData;
if ($_POST === array()) {
    //Views Input Form at first
    //use your template engine
    $views->context = $data;
    return $views;
}else {
   //Submitted Form
   //pickup and overwrite values
   $data->bind($_POST);
}

//Form depends FormObject\Data
$form = new FooForm($data);
$form->execute();

//use your template engine
$views->context = $form->getData();
return $views;
```

State Pattern?
--------------

[](#state-pattern)

```
//Define Data
class FooData extends \FormObject\Data
{
    public $state = 'init';
    public $name = '';
    public $hash = '';
}

//Define State
class FooValidate extends \FormObject\StateBase
{
    protected $name = 'validate';
    public function execute()
    {
       //You can use great Validation Libraries

       $this->getData()->state = $this->getName();

       //Next State Class String or Instance
       return 'FooConfirm';
    }
}

class FooConfirm extends \FormObject\StateBase
{
    protected $name = 'confirm';
    public function execute()
    {
       //insert CSRF Hash
       $data = $this->getData();
       $data->state = $this->getName();
       return ;
    }
}

class FooFinish extends \FormObject\StateBase
{
    protected $name = 'finish';
    public function execute()
    {
       //check CSRF
       //register data
       //send mail
       //logging
       $this->getData()->state = $this->getName();
       return ;
    }
}

$data = new FooData();
$data->bind($_POST);

switch ($data->state) {
   case 'input':
   $form = new FooValidate($data);

   //automatic switch state
   $dispatcher = new \FormObject\Dispatcher($form);
   $form = $dispatcher->dispatch();
   break;

   case 'confirm':
   $form = new FooFinish($data);
   $form->execute();
   redirect('form/finish.html');
   break;

   default:
   $view->context = $data;
   return $view;
}

$view->context = $form->getData();
return $view;
```

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3863d ago

### Community

Maintainers

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

---

Top Contributors

[![reioto](https://avatars.githubusercontent.com/u/2361918?v=4)](https://github.com/reioto "reioto (18 commits)")

---

Tags

formOOP

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[cakephp/cakephp

The CakePHP framework

8.8k19.1M1.7k](/packages/cakephp-cakephp)[kartik-v/yii2-widgets

Collection of useful widgets for Yii Framework 2.0 extending functionalities for Bootstrap

5594.0M118](/packages/kartik-v-yii2-widgets)[atk4/ui

Agile UI - Web Component Framework written in PHP

457541.3k33](/packages/atk4-ui)[yiisoft/form

The package helps with implementing data entry forms.

47101.7k1](/packages/yiisoft-form)[nextras/form-components

Form components for Nette Framework.

10249.1k](/packages/nextras-form-components)[yiisoft/form-model

Provides a base for form models and helps to fill, validate and display them.

1744.7k6](/packages/yiisoft-form-model)

PHPackages © 2026

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