simplethings/form-extra-bundle
A Symfony bundle that adds practical extra form types and helpers for building complex forms with less boilerplate. It offers reusable utilities and improved collection handling to keep form code cleaner and easier to maintain.
This is not a Laravel package; it is a Symfony 2 bundle. From a Laravel developer's perspective, evaluate it as a reference for wrapping JavaScript widgets in reusable form fields, not as something you can composer require into a Laravel app.
Minimal legacy Symfony 2 setup:
Require the bundle in a Symfony 2 project:
composer require simplethings/form-extra-bundle
Register the bundle in app/AppKernel.php:
public function registerBundles()
{
$bundles = [
// ...
new SimpleThings\FormExtraBundle\SimpleThingsFormExtraBundle(),
];
return $bundles;
}
Add configuration for any widget that needs keys or defaults:
# app/config/config.yml
simple_things_form_extra:
recaptcha:
public_key: "%recaptcha_public_key%"
private_key: "%recaptcha_private_key%"
Look first at:
README.md for the supported form type aliases.Form/Type/ for the actual types: typically Chosen, TinyMCE, Recaptcha, Datepicker-style wrappers.Resources/config/ for service definitions and configuration keys.Resources/views/Form/ for Twig form themes.First practical use case: replace hand-written admin form markup:
$builder
->add('category', 'chosen', [
'choices' => $categories,
'attr' => ['data-placeholder' => 'Choose a category'],
])
->add('body', 'tinymce')
->add('captcha', 'recaptcha');
In Symfony 2.8+ you may be able to reference the type class directly, but older Symfony 2 apps typically use the registered service alias such as chosen, tinymce, or recaptcha.
Admin CRUD forms. The bundle is most useful for back-office forms where you want a select box enhanced by Chosen, a textarea enhanced by TinyMCE, or a reCAPTCHA field without repeating markup and JavaScript initialization in every template.
Wrap widget configuration in custom form types. Instead of scattering the extra types across controllers, create application-specific types:
class ArticleType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('title', 'text')
->add('category', 'chosen', [
'choices' => $options['categories'],
])
->add('body', 'tinymce')
->add('captcha', 'recaptcha');
}
}
This keeps the third-party widget choices in one place and makes it easier to replace the bundle later.
Configuration-driven keys. Put reCAPTCHA keys in parameters.yml, not in the form type. This matches Symfony 2 conventions and keeps environment-specific secrets out of code.
Asset loading order matters. These types generally render the form field and sometimes add a class or template fragment; they do not replace your asset pipeline. Ensure jQuery and the widget library are loaded before the form initialization code. With Symfony 2 that often means Assetic or explicit layout includes:
{% block javascripts %}
<script src="{{ asset('js/jquery.js') }}"></script>
<script src="{{ asset('js/chosen.jquery.js') }}"></script>
{% endblock %}
Progressive enhancement. Treat the extra types as enhancements over normal Symfony form fields. A ChosenType field should still submit a normal scalar value; a TinymceType should still fall back to a textarea if JavaScript fails.
Recaptcha validation is server-side. Do not rely on the rendered widget alone. Confirm that the bundle's validator or your own controller/service performs the remote verification and adds a form error when verification fails.
Reusable application form theme. If the bundle's default markup does not match your Bootstrap or admin theme, override the form theme in config.yml:
twig:
form_themes:
- 'form/fields.html.twig'
Then copy and adapt the bundle's Twig blocks rather than editing vendor files.
This is Symfony 2 only. It is not installable or usable in Laravel. Laravel has no bundle registration system, no Symfony form component by default, and no Twig form themes. If you are working in Laravel, port the idea to Blade components, Livewire, or Laravel Collective-style macros.
The package is effectively abandoned. Last release was 2014, before Symfony 3, modern PHP, and current reCAPTCHA APIs. Do not introduce it into a new project. Use it only when maintaining an existing Symfony 2 application.
Old reCAPTCHA support is a serious risk. A 2014 reCAPTCHA integration likely targets reCAPTCHA v1, which Google shut down. Verify the generated markup and server-side endpoint before relying on it. In most cases you will need to replace the recaptcha type with a modern v2/v3 implementation.
Modern JavaScript libraries may not match. Chosen, TinyMCE, and datepicker versions from the Symfony 2 era may use initialization APIs that differ from current releases. Override the bundle templates or JavaScript initialization rather than patching vendor code.
Composer conflicts are likely. The package's Symfony and PHP constraints target PHP 5-era projects. On PHP 7/8 or Symfony 3+ you will likely need an isolated legacy environment or a fork with updated constraints.
Check the actual configuration key. Bundle config roots are easy to mistype. Use:
php app/console config:dump-reference SimpleThingsFormExtraBundle
and inspect service IDs with:
php app/console debug:container | grep simple_things
Do not edit vendor files for template fixes. Override Twig form themes and bundle templates in app/Resources/SimpleThingsFormExtraBundle/ or through form_themes.
Debugging form type aliases. If 'chosen' or 'tinymce' is not recognized, confirm the bundle is registered and the service alias exists. In newer Symfony 2.8 apps, using the form type class directly can be clearer.
Extension points are limited but useful. You can replace the bundle's form type services, override its Twig blocks, or create your own types that compose the bundle's types. For anything beyond a legacy maintenance fix, prefer writing a small custom form type around the current JavaScript library instead of depending on this bundle.
How can I help you explore Laravel packages today?