PHPackages                             lin3s/wp-symfony-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. lin3s/wp-symfony-form

ActiveWordpress-plugin[Utility &amp; Helpers](/categories/utility)

lin3s/wp-symfony-form
=====================

WordPress plugin to allow using Symfony form component with ease

v0.4.1(10y ago)01.1k1[1 issues](https://github.com/LIN3S/WPSymfonyForm/issues)[1 PRs](https://github.com/LIN3S/WPSymfonyForm/pulls)MITPHPPHP ^5.5 || ^7.0

Since Jun 30Pushed 9y ago3 watchersCompare

[ Source](https://github.com/LIN3S/WPSymfonyForm)[ Packagist](https://packagist.org/packages/lin3s/wp-symfony-form)[ Docs](http://lin3s.com)[ RSS](/packages/lin3s-wp-symfony-form/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (5)Dependencies (9)Versions (13)Used By (0)

\#WP Symfony Form

> WordPress plugin to allow using Symfony form component with ease

[![SensioLabsInsight](https://camo.githubusercontent.com/188a2b825b06a406fe784482100138b18f1114c548aff2ac18cc2a09893fe32f/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f37383964316563392d366137642d346230362d623535612d3737623364303831636564632f6d696e692e706e67)](https://insight.sensiolabs.com/projects/789d1ec9-6a7d-4b06-b55a-77b3d081cedc)[![Build Status](https://camo.githubusercontent.com/977e9693c722443a329a266df75f25e6f7f0399f45978c63ac2cbca349515c64/68747470733a2f2f7472617669732d63692e6f72672f4c494e33532f575053796d666f6e79466f726d2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/LIN3S/WPSymfonyForm)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/1e88d7a96cc1ad3b8ef23c3784725b1b000ffb2cf57523557f3779185d94e2be/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4c494e33532f575053796d666f6e79466f726d2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/LIN3S/WPSymfonyForm/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/7c76ab2678bee336afbf578cd6969f80239e6675712246e31bf990428945644e/68747470733a2f2f706f7365722e707567782e6f72672f6c696e33732f77702d73796d666f6e792d666f726d2f646f776e6c6f616473)](https://packagist.org/packages/lin3s/wp-symfony-form) [![Latest Stable Version](https://camo.githubusercontent.com/28c70fa5cbbc4e166a54142cfd9cf86263fc0b994885a8ff962ffef49d789443/68747470733a2f2f706f7365722e707567782e6f72672f6c696e33732f77702d73796d666f6e792d666f726d2f762f737461626c652e737667)](https://packagist.org/packages/lin3s/wp-symfony-form)[![Latest Unstable Version](https://camo.githubusercontent.com/7646a96f0e2d80b442f3fcc8b1eb0a38db03cec61ded7fe8f42146b7a53e01f3/68747470733a2f2f706f7365722e707567782e6f72672f6c696e33732f77702d73796d666f6e792d666f726d2f762f756e737461626c652e737667)](https://packagist.org/packages/lin3s/wp-symfony-form)

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

[](#installation)

If you are using composer run the following command:

```
$ composer require lin3s/wp-symfony-form
```

If your `composer.json` is properly set up you should find this package in plugins folder

Usage
-----

[](#usage)

First of all, **enable this plugin in the WordPress admin panel**.

To create your first form extend as usual from the `AbstractType` class provided by Symfony component.

```
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints;

class ContactType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('name', TextType::class, [
                'constraints' => new Constraints\NotBlank(),
                'label'       => 'Name',
            ])
            ->add('surname', TextType::class, [
                'constraints' => new Constraints\NotBlank(),
                'label'       => 'Surname',
            ])
            ->add('phone', TextType::class, [
                'constraints' => new Constraints\NotBlank(),
                'label'       => 'Phone',
            ])
            ->add('email', EmailType::class, [
                'constraints' => new Constraints\Email(),
                'label'       => 'Email',
            ])
            ->add('message', TextareaType::class, [
                'constraints' => new Constraints\NotBlank(),
                'label'       => 'Message',
            ])
            ->add('conditions', CheckboxType::class, [
                'mapped' => false,
            ]);
    }
}
```

To enable the Ajax calls for this form you need to subscribe to the `wp_symfony_form_wrappers` WordPress hook.

```
add_filter('wp_symfony_form_wrappers', function($formWrappers) {
    $formWrappers->add(
        new FormWrapper(
            'contact',
            'Fully/Qualified/Namespace/ContactType'
        )
    );
});
```

\###Rendering the form In case you want to use Twig for rendering a Bridge is provided, just run the following code line passing Twig instance

```
TwigBridge::addExtension($twig);

// if you want to customize the form theme
TwigBridge::addExtension($twig, 'component/form.twig');
```

> `component/form.twig` is your custom form theme that will be used to render the forms. Check the docs about [form customization](http://symfony.com/doc/current/cookbook/form/form_customization.html#what-are-form-themes) for further info.

**Timber**In case you are using Timber you should use `twig_apply_filters` hook.
Also, you have to load the form base views inside *Timber* global locations variable:

```
\Timber\Timber::$locations = [
    (...)
    ABSPATH . '../vendor/symfony/twig-bridge/Resources/views/Form/',
];
```

**Important** Submit event is binded to every element with `.form` class. In case you need to change it just do the following:

```
WPSymfonyForm.formSelector = '.your-selector';
```

Also error container for each form item can be changed using `WPSymfonyForm.formErrorsSelector`.

\###The FormWrapper The `FormWrapper` is a class designed to contain a form and all its related actions. As you've seen above a new instance is created for each form you want to use in your WordPress project, and need to be registered inside the `FormWrapperRegistry`.

As first parameter it receives the fully qualified namespace and as second parameter it receives an array of classes implementing `Action` interface.

\###Actions on success In case you need to perform any **server side** actions, it's as easy as to implement `execute` method of `Action` interface. A form instance will to be used as desired. Check `src/Action` folder to check already implemented actions.

To bind this action to a specific form you need to add it in the `FormWrapper`.

For **client side** success actions you can add your callback using the global `WPSymfonyForm` namespace as follows:

```
    WPSymfonyForm.onSuccess(function ($form) {
      if ($form.hasClass('form--contact')) {
        // ANYTHING YOU WANT TO DO
      }
      $form.find('.form__footer').html('Form successfully submitted');
    });
```

> `onSuccess()` and `onError()` are available to hook into the form.

###  Health Score

28

—

LowBetter than 51% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60.6% 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 ~48 days

Recently: every ~30 days

Total

9

Last Release

3675d ago

PHP version history (2 changes)v0.2.0PHP ^5.5|^7.0

v0.4.0PHP ^5.5 || ^7.0

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/06308bfc15d8774c16d36d727f852c2d29ed8d0d6153637384439747776dc658?d=identicon)[benatespina](/maintainers/benatespina)

---

Top Contributors

[![benatespina](https://avatars.githubusercontent.com/u/3951376?v=4)](https://github.com/benatespina "benatespina (20 commits)")[![gorkalaucirica](https://avatars.githubusercontent.com/u/1749891?v=4)](https://github.com/gorkalaucirica "gorkalaucirica (13 commits)")

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/lin3s-wp-symfony-form/health.svg)

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

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k18.3M418](/packages/easycorp-easyadmin-bundle)[chameleon-system/chameleon-base

The Chameleon System core.

1029.4k6](/packages/chameleon-system-chameleon-base)[contao/core-bundle

Contao Open Source CMS

1301.7M3.0k](/packages/contao-core-bundle)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.8M668](/packages/shopware-core)[sylius/sylius

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

8.5k6.0M776](/packages/sylius-sylius)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.9M534](/packages/pimcore-pimcore)

PHPackages © 2026

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