PHPackages                             hostnet/form-twig-bridge - 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. [Templating &amp; Views](/categories/templating)
4. /
5. hostnet/form-twig-bridge

AbandonedArchivedLibrary[Templating &amp; Views](/categories/templating)

hostnet/form-twig-bridge
========================

Allows usage of the Symfony 3 form framework, rendered in twig, without using all of Symfony 3!

2.0.1(10y ago)1222.4k5MITPHPPHP &gt;=5.6

Since Feb 12Pushed 9y ago1 watchersCompare

[ Source](https://github.com/hostnet/form-twig-bridge)[ Packagist](https://packagist.org/packages/hostnet/form-twig-bridge)[ Docs](https://github.com/hostnet/form-twig-bridge)[ RSS](/packages/hostnet-form-twig-bridge/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (3)Dependencies (9)Versions (17)Used By (0)

**Not maintained, not in use within Hostnet**

Pull requests will be accepted

form-twig-bridge
----------------

[](#form-twig-bridge)

This package might be nice for you if you

- Want to use the Symfony 2 form component
- With the Twig rendering
- But don't want to use all of Symfony 2

It's inspired by Bernhard Schussek's [standalone-forms](https://github.com/bschussek/standalone-forms/).

If you want to use more then just the form framework, and you're inside a Symfony 1 application, maybe the [hnDependencyInjectionPlugin](https://github.com/hostnet/hnDependencyInjectionPlugin) is more suitable for you.

[![Total Downloads](https://camo.githubusercontent.com/da8a38cbf8f68d1b1671f56c6a28c2f962653ebd6ebc81f08d69a92fe535c4dd/68747470733a2f2f706f7365722e707567782e6f72672f686f73746e65742f666f726d2d747769672d6272696467652f646f776e6c6f6164732e706e67)](https://packagist.org/packages/hostnet/form-twig-bridge)[![Build Status](https://camo.githubusercontent.com/974c9254c93fdd19323b671658b24b2170f4ef224e42b933c43fd38431c97622/68747470733a2f2f7472617669732d63692e6f72672f686f73746e65742f666f726d2d747769672d6272696467652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/hostnet/form-twig-bridge)

### Installation

[](#installation)

1. [Download Composer](http://getcomposer.org/doc/00-intro.md).
2. Add to your composer.json

```
"require": {
    "hostnet/form-twig-bridge": ">=1.0"
}

```

3. Use the builders to create a FormFactory and a Twig\_Environment with the correct configuration: ```
    use Hostnet\FormTwigBridge\Builder;
    use Symfony\Component\Security\Csrf\TokenStorage\NativeSessionTokenStorage;

    $csrf = new NativeSessionTokenStorage();
    $translator_builder = new TranslatorBuilder();
    // $translator_builder->setLocale('nl_NL'); // Uncomment if you want a non-english locale
    $builder = new Builder();
    $environment = $builder
        ->setCsrfTokenManager($csrf)
        ->setTranslator($translator_builder->build())
        ->createTwigEnvironmentBuilder()->build();
    $factory = $builder->buildFormFactory();

    ```
4. Use the form factory to create your form, see the [symfony docs](http://symfony.com/doc/current/book/forms.html).
5. If you use Twig templates: Use the form factory and the twig environment like you'd normally do
6. If you use PHP templates, use the [public methods](https://github.com/hostnet/form-twig-bridge/blob/master/src/Hostnet/FormTwigBridge/PhpRenderer.php) of the PhpRenderer. Initialize it with `new PhpRenderer($twig_environment)`

### Optional configuration options

[](#optional-configuration-options)

Builder

- `enableAnnotationMapping` enables doctrine annotation mapping (requires [doctrine/annotations](https://packagist.org/packages/doctrine/annotations))
- `addFormExtension` adds your custom form extensions

TwigEnvironmentBuilder

- `prependTwigLoader` adds additional twig loaders that are called before the loader added by the form-twig-bridge. You can always add loaders yourself, even after building.
- `setFormTheme` for a custom form theme, note that you will have to add a loader that loads your form theme

### Changelog

[](#changelog)

1.1.0

- Now works with Symfony 2.7.0
- Deprecated `setCsrfProvider` in favour of `setCsrfTokenManager` for Symfony 3.0 compatibility

1.0.1

- Can now be used inside a full-fletched Symfony2 framework.

1.0

- Upgraded from Symfony 2.1 to Symfony 2.3.
- \[Breaking\] Added `setTranslator` to `Builder`.
- \[Breaking\] Removed `setLocale` from the `TwigEnvironmentBuilder`.

### Running the unit-tests

[](#running-the-unit-tests)

1. Clone the repository yourself
2. Go to the directory of the clone
3. Run `composer.phar install`
4. Run `phpunit`

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~79 days

Recently: every ~101 days

Total

15

Last Release

3784d ago

Major Versions

0.5 → 1.02013-06-13

1.0.x-dev → 2.0.02016-02-09

PHP version history (2 changes)1.0.x-devPHP &gt;=5.5

2.0.0PHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/65433e1ef6edb2e8f96e18614b6618c84eed20ad0de6de0d0da36a9032ec7a18?d=identicon)[hostnet](/maintainers/hostnet)

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

---

Top Contributors

[![yannickl88](https://avatars.githubusercontent.com/u/5468127?v=4)](https://github.com/yannickl88 "yannickl88 (5 commits)")[![linaori](https://avatars.githubusercontent.com/u/1754678?v=4)](https://github.com/linaori "linaori (2 commits)")[![nicoschoenmaker](https://avatars.githubusercontent.com/u/1469323?v=4)](https://github.com/nicoschoenmaker "nicoschoenmaker (2 commits)")[![hboomsma](https://avatars.githubusercontent.com/u/1465009?v=4)](https://github.com/hboomsma "hboomsma (1 commits)")

---

Tags

twigform

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hostnet-form-twig-bridge/health.svg)

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

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[chameleon-system/chameleon-base

The Chameleon System core.

1028.6k5](/packages/chameleon-system-chameleon-base)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M738](/packages/sylius-sylius)[oro/platform

Business Application Platform (BAP)

645143.5k115](/packages/oro-platform)[contao/core-bundle

Contao Open Source CMS

1231.6M2.8k](/packages/contao-core-bundle)

PHPackages © 2026

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