PHPackages                             steevanb/sf2-form-utils - 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. steevanb/sf2-form-utils

Abandoned → [steevanb/symfony-form-options-builder](/?search=steevanb%2Fsymfony-form-options-builder)Library[Utility &amp; Helpers](/categories/utility)

steevanb/sf2-form-utils
=======================

buildForm() with objects instead of array

5.1.0(2y ago)03943[11 issues](https://github.com/steevanb/symfony-form-options-builder/issues)[1 PRs](https://github.com/steevanb/symfony-form-options-builder/pulls)Apache-2.0PHPPHP ^7.1||^8.0

Since Jul 13Pushed 2y ago1 watchersCompare

[ Source](https://github.com/steevanb/symfony-form-options-builder)[ Packagist](https://packagist.org/packages/steevanb/sf2-form-utils)[ RSS](/packages/steevanb-sf2-form-utils/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (4)Versions (41)Used By (0)

[![version](https://camo.githubusercontent.com/ea11b732c9a71f6c72b419036ac9f3fca27c9b819b77338df5866ebd24ee549d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d352e302e302d677265656e2e737667)](https://github.com/steevanb/symfony-form-options-builder/tree/5.0.0)[![php](https://camo.githubusercontent.com/f61e6495979e8dc1610eab07ea71a56cc5ef61a7c5459465585a874057a4a04f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545372e31253743253743253545382e302d626c75652e737667)](https://php.net)[![symfony](https://camo.githubusercontent.com/fc05e617cf9fd96eaa4c51b7d81beb39e668b2eb74afd78f8c2d70f21e3aa0bc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73796d666f6e792f666f726d2d25354533253743253743253545342537432537432535453525374325374325354536253743253743253545372d626c75652e737667)](https://symfony.com)[![Lines](https://camo.githubusercontent.com/b191dd4d7884648738b9599d2065208ee450c89f7e4790669c0dbf77f07a550d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f64652532306c696e65732d343931382d677265656e2e737667)](https://camo.githubusercontent.com/b191dd4d7884648738b9599d2065208ee450c89f7e4790669c0dbf77f07a550d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f64652532306c696e65732d343931382d677265656e2e737667)[![Total Downloads](https://camo.githubusercontent.com/d00eee0ddad5e7275ff531de5ca64e9c79affa489ab4f9e9b445009046c16487/68747470733a2f2f706f7365722e707567782e6f72672f7374656576616e622f73796d666f6e792d666f726d2d6f7074696f6e732d6275696c6465722f646f776e6c6f616473)](https://camo.githubusercontent.com/d00eee0ddad5e7275ff531de5ca64e9c79affa489ab4f9e9b445009046c16487/68747470733a2f2f706f7365722e707567782e6f72672f7374656576616e622f73796d666f6e792d666f726d2d6f7074696f6e732d6275696c6465722f646f776e6c6f616473)[![Scrutinizer](https://camo.githubusercontent.com/ace65e46d6b3eb521bb07f7612e0199dc648d4f6ab818ab5fb56e3f9e98bd85b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7374656576616e622f73796d666f6e792d666f726d2d6f7074696f6e732d6275696c6465722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/steevanb/symfony-form-options-builder/)

symfony-form-options-builder
============================

[](#symfony-form-options-builder)

It helps you writing your Symfony FormType, with some traits and methods to add fields in buildForm() instead of array with some mysterious keys, and other stuff.

[Installation](documentation/installation.md)

[Changelog](changelog.md)

Object-oriented FormType
------------------------

[](#object-oriented-formtype)

FormType::buildForm() object oriented instead of array

Example:

```
namespace FooBundle\Form\Type;

use Steevanb\SymfonyFormOptionsBuilder\OptionsBuilder\EmailOptionsBuilder;
use Steevanb\SymfonyFormOptionsBuilder\OptionsBuilder\TextOptionsBuilder;
use Symfony\Component\Form\Extension\Core\Type\TextType;

class BarType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        # Since PHP 5.5, you can use FooClass::class
        $builder->add('field_text', TextType::class, TextOptionsBuilder::create()->asArray());

        # Since PHP 5.6, you can use the variadic syntax. asVariadic() parameter is field name.
        $builder->add(
            ...EmailOptionsBuilder::create()
                ->setRequired(false)
                ->setPlaceHolder('default@mail.com')
                ->setTrim(false)
                ->asVariadic('field_email')
        );
    }
}
```

[More documentation](documentation/optionsbuilder.md)

BlockPrefixTrait
----------------

[](#blockprefixtrait)

Add getBlockPrefix(), to always return same syntax for form type getBlockPrefix() method: form\_type\_formtypeclassname

Example:

```
namespace FooBundle\Form\Type;

use Steevanb\SymfonyFormOptionsBuilder\BlockPrefixTrait;

class BarType extends AbstractType
{
    # Use this trait to define getBlockPrefix() required method. It will return form_type_bar
    use BlockPrefixTrait;
}
```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 97.8% 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 ~87 days

Recently: every ~223 days

Total

38

Last Release

739d ago

Major Versions

1.4.2 → 2.0.02015-12-01

2.1.5 → 3.0.02016-06-01

3.3.2 → 4.0.02018-01-18

4.4.1 → 5.0.02024-04-19

PHP version history (4 changes)1.0.0PHP &gt;=5.4

4.0.0PHP ^7.1

4.3.0PHP ^7.1 || ^8.0

4.4.1PHP ^7.1||^8.0

### Community

Maintainers

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

---

Top Contributors

[![steevanb](https://avatars.githubusercontent.com/u/5063383?v=4)](https://github.com/steevanb "steevanb (178 commits)")[![ZeMarine](https://avatars.githubusercontent.com/u/158932?v=4)](https://github.com/ZeMarine "ZeMarine (2 commits)")[![acoquoin](https://avatars.githubusercontent.com/u/990484?v=4)](https://github.com/acoquoin "acoquoin (1 commits)")[![onishinji](https://avatars.githubusercontent.com/u/204132?v=4)](https://github.com/onishinji "onishinji (1 commits)")

---

Tags

formtypephpsymfony

### Embed Badge

![Health badge](/badges/steevanb-sf2-form-utils/health.svg)

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

###  Alternatives

[barryvdh/laravel-form-bridge

This packages integrates Symfony Form Component in Laravel.

163354.8k1](/packages/barryvdh-laravel-form-bridge)[pugx/autocompleter-bundle

Add an autocomplete type to forms

93861.6k3](/packages/pugx-autocompleter-bundle)[jbtronics/settings-bundle

A symfony bundle to easily create typesafe, user-configurable settings for symfony applications

9546.7k2](/packages/jbtronics-settings-bundle)[symfony/ux-toggle-password

Toggle visibility of password inputs for Symfony Forms

26508.0k5](/packages/symfony-ux-toggle-password)[pixelopen/cloudflare-turnstile-bundle

A simple package to help integrate Cloudflare Turnstile on Symfony.

31205.8k3](/packages/pixelopen-cloudflare-turnstile-bundle)[netgen/layouts-core

Netgen Layouts enables you to build and manage complex web pages in a simpler way and with less coding. This is the core of Netgen Layouts, its heart and soul.

3689.4k10](/packages/netgen-layouts-core)

PHPackages © 2026

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