PHPackages                             th3mouk/contact-bundle - 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. th3mouk/contact-bundle

AbandonedSymfony-bundle[Templating &amp; Views](/categories/templating)

th3mouk/contact-bundle
======================

Symfony Th3MoukContactBundle to factorize contact form generation throught websites.

1.2.0(10y ago)0280MITPHP

Since Oct 8Pushed 10y ago1 watchersCompare

[ Source](https://github.com/Th3Mouk/ContactBundle)[ Packagist](https://packagist.org/packages/th3mouk/contact-bundle)[ RSS](/packages/th3mouk-contact-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (9)Used By (0)

Contact Bundle
==============

[](#contact-bundle)

This [Symfony](http://symfony.com/) bundle providing base for manage contact form.

The aim is to factorise website contact form.

[![SensioLabsInsight](https://camo.githubusercontent.com/46bf5f8d870a0398c0a52d81f71247a5a229bd5328fee7b113b6960a4148fab9/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f38623964376166662d396437332d346135342d386335372d6564633232353761323461622f6d696e692e706e67)](https://insight.sensiolabs.com/projects/8b9d7aff-9d73-4a54-8c57-edc2257a24ab) [![Latest Stable Version](https://camo.githubusercontent.com/0b92734ef49447da734038062c858acb4bd8a5ab05d6c24d2589aca39a3be990/68747470733a2f2f706f7365722e707567782e6f72672f7468336d6f756b2f636f6e746163742d62756e646c652f762f737461626c65)](https://packagist.org/packages/th3mouk/contact-bundle) [![Total Downloads](https://camo.githubusercontent.com/f8c4be0d576bf3459c76839b9d79926c080a8b1da04169c84da6528381289b2b/68747470733a2f2f706f7365722e707567782e6f72672f7468336d6f756b2f636f6e746163742d62756e646c652f646f776e6c6f616473)](https://packagist.org/packages/th3mouk/contact-bundle) [![Build Status](https://camo.githubusercontent.com/7951bf852a5df3074f8b5bd801642c51308c0a986356a9dc1641cb58049be1fc/68747470733a2f2f7472617669732d63692e6f72672f5468334d6f756b2f436f6e7461637442756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Th3Mouk/ContactBundle) [![Latest Unstable Version](https://camo.githubusercontent.com/01dc8bbf48410bd1e4f4f13a850e091aa52e5ed080fa4392b7b84c064f2a09a1/68747470733a2f2f706f7365722e707567782e6f72672f7468336d6f756b2f636f6e746163742d62756e646c652f762f756e737461626c65)](https://packagist.org/packages/th3mouk/contact-bundle) [![License](https://camo.githubusercontent.com/be5a7e886e6c70044c4e9a68a410d3210bda51515444c8781edad33fb02376e7/68747470733a2f2f706f7365722e707567782e6f72672f7468336d6f756b2f636f6e746163742d62756e646c652f6c6963656e7365)](https://packagist.org/packages/th3mouk/contact-bundle)

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

[](#installation)

`php composer.phar require th3mouk/contact-bundle ^1.2`

Add to the `appKernel.php`:

```
new Th3Mouk\ContactBundle\Th3MoukContactBundle(),
```

Update your `routing.yml` application's file.

```
th3mouk_contact:
    resource: "@Th3MoukContactBundle/Resources/config/routing.yml"
    prefix:   /contact
```

Configure entities and templates in `config.yml`

```
th3mouk_contact:
    datas:
        from: noreply@domain.com
        to:
            - test.mail@domain.com
        subject: Contact request from your website

    class:
        entity: AppBundle\Entity\Contact
        formType: AppBundle\Form\ContactType

    templates:
        application: AppBundle:Contact:contact.html.twig
        mailer: AppBundle:Contact:mail.html.twig

    flash_messages:
        success: contact.mail.success
        error: contact.mail.error
```

Usage
-----

[](#usage)

Create `Contact` entity that implement the `Th3Mouk\ContactBundle\Entity\ContactInterface` with the `app/console d:g:entity`.

Generate the relative FormType: `app/console d:g:f AppBundle:Contact`.

Create two template for frontend and mail, you have access to `form` object to draw your form, and your `contact` object in the mail template.

Check the following exemples:

### Exemple of ContactType

[](#exemple-of-contacttype)

```
namespace AppBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class ContactType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array                $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('name')
            ->add('adress')
            ->add('zipCode')
            ->add('city')
            ->add('phone')
            ->add('email', 'email')
            ->add('message')
        ;
    }

    /**
     * @param OptionsResolver $resolver
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'AppBundle\Entity\Contact',
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'app_contact_type';
    }
}
```

### Exemple of Form Template

[](#exemple-of-form-template)

```
Contact Request

{{ form_start(form) }}

{{ form_row(form.name) }}
{{ form_row(form.adress) }}
{{ form_row(form.zipCode) }}
{{ form_row(form.city) }}
{{ form_row(form.phone) }}
{{ form_row(form.email) }}
{{ form_row(form.message) }}

Submit

{{ form_rest(form) }}
{{ form_end(form) }}
```

### Exemple of Mail Template

[](#exemple-of-mail-template)

```
{{ contact.name }}
{{ contact.adress }}
{{ contact.zipCode }}
{{ contact.city }}
{{ contact.phone }}
{{ contact.email }}
{{ contact.message }}
```

### Sonata Integration Exemple

[](#sonata-integration-exemple)

First use the `app/console sonata:admin:generate` command.

Then add the service configuration:

```
app.admin.contact:
    class: AppBundle\Admin\ContactAdmin
    arguments: [~, AppBundle\Entity\Contact, SonataAdminBundle:CRUD]
    tags:
        - {name: sonata.admin, manager_type: orm, label: Contacts}
```

Add the admin group on the dashboard:

```
sonata.admin.group.contact:
    label:           Contact
    label_catalogue: SonataPageBundle
    icon:            ''
    items:
        - app.admin.contact
    roles: [ ROLE_ADMIN ]
```

Don't forget to add this group on a block:

```
sonata_admin:
    dashboard:
        blocks:
            - { position: left, type: sonata.admin.block.admin_list, settings: { groups: [...sonata.admin.group.contact...] }}
```

You're done! 👍

Events
------

[](#events)

You have access to two events before and after mail was send :

- [MailerEventsDefinition](https://github.com/Th3Mouk/ContactBundle/tree/master/Events/MailerEventsDefinition)

Please
------

[](#please)

Feel free to improve this bundle.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity68

Established project with proven stability

 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

Every ~22 days

Total

6

Last Release

3764d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5006899?v=4)[Jérémy](/maintainers/Th3Mouk)[@Th3Mouk](https://github.com/Th3Mouk)

---

Top Contributors

[![Th3Mouk](https://avatars.githubusercontent.com/u/5006899?v=4)](https://github.com/Th3Mouk "Th3Mouk (27 commits)")

---

Tags

symfonybundlecontactcontact mailer

### Embed Badge

![Health badge](/badges/th3mouk-contact-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/th3mouk-contact-bundle/health.svg)](https://phpackages.com/packages/th3mouk-contact-bundle)
```

###  Alternatives

[endroid/qr-code-bundle

Endroid QR Code Bundle

32110.6M17](/packages/endroid-qr-code-bundle)[tales-from-a-dev/flowbite-bundle

A Symfony form theme for Flowbite

86252.8k2](/packages/tales-from-a-dev-flowbite-bundle)[yellowskies/qr-code-bundle

Symfony Barcode &amp; QR Code Generator Bundle with Twig extension

36682.9k](/packages/yellowskies-qr-code-bundle)[cg/kint-bundle

This bundle lets you use the Kint function in your Twig templates. Kint is a print\_r() replacement which produces a structured, collapsible and escaped output

22125.8k1](/packages/cg-kint-bundle)

PHPackages © 2026

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