PHPackages                             c975l/contactform-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. c975l/contactform-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

c975l/contactform-bundle
========================

Bundle to manage simple contact form

v7.16.1(3d ago)2852MITPHPPHP &gt;=8.0

Since Jun 5Pushed 2d ago1 watchersCompare

[ Source](https://github.com/975L/ContactFormBundle)[ Packagist](https://packagist.org/packages/c975l/contactform-bundle)[ Docs](https://github.com/975L/ContactFormBundle)[ Fund](https://buymeacoff.ee/laurentmarquet)[ Fund](https://opencollective.com/laurent-marquet)[ RSS](/packages/c975l-contactform-bundle/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (24)Versions (116)Used By (0)

ContactFormBundle
=================

[](#contactformbundle)

Symfony bundle that provides a fully-featured contact form with built-in spam protection, reCaptcha v3, rate limiting, event-driven customization, and multilingual support.

[![GitHub](https://camo.githubusercontent.com/3bd5ac5954221787411e5a00e40396aad64f67ec719c8d2471b3e7ffb3fcb9ea/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f3937354c2f436f6e74616374466f726d42756e646c65)](https://github.com/975L/ContactFormBundle/blob/master/LICENSE)[![Packagist Version](https://camo.githubusercontent.com/c557348c8bbe7a41f555923a5cffeec21ef691dac1026dffffe63e1f30f2d268/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f633937356c2f636f6e74616374666f726d2d62756e646c65)](https://packagist.org/packages/c975l/contactform-bundle)[![PHP Version](https://camo.githubusercontent.com/8b493217dcbf95d20e8effe410bc288d1ff52554830e958f598cbc51620c7d97/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f633937356c2f636f6e74616374666f726d2d62756e646c65)](https://packagist.org/packages/c975l/contactform-bundle)

---

Features
--------

[](#features)

- Contact form at `/contact` (or `/{_locale}/contact` for multilingual apps)
- Pre-fills name and email when a user is logged in
- Sends emails via Symfony Mailer (`TemplatedEmail`)
- Dispatches events to customize form behavior and email content
- **Anti-spam:** dynamic honeypot with randomized field names and labels per session
- **Anti-spam:** minimum submission delay check to reject bot submissions
- **Anti-spam:** reCaptcha v3 via [`karser/KarserRecaptcha3Bundle`](https://github.com/karser/KarserRecaptcha3Bundle)
- **Rate limiting:** optional limits by IP and by email address
- GDPR consent checkbox (configurable)
- Optional "receive a copy" checkbox for the sender
- Subject pre-fill via URL parameter (`?s=My+Subject`)
- Configuration managed via [c975L/ConfigBundle](https://github.com/975L/ConfigBundle)

---

Requirements
------------

[](#requirements)

- PHP &gt;= 8.0
- Symfony &gt;= 7.0
- [c975L/ConfigBundle](https://github.com/975L/ConfigBundle)
- [c975L/SiteBundle](https://github.com/975L/SiteBundle)
- [karser/karser-recaptcha3-bundle](https://github.com/karser/KarserRecaptcha3Bundle)

---

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

[](#installation)

### Download

[](#download)

```
composer require c975l/contactform-bundle
```

### Enable routes

[](#enable-routes)

Add the following to `config/routes.yaml`:

```
c975_l_contact_form:
    resource: "@c975LContactFormBundle/"
    type: attribute
    prefix: /
    # For multilingual websites:
    # prefix: /{_locale}
    # defaults: { _locale: '%locale%' }
    # requirements:
    #     _locale: en|fr|es
```

### Load configuration values

[](#load-configuration-values)

```
php bin/console c975l:config:load-all
```

Then use the ConfigBundle dashboard to set the values for each key.

### Configure reCaptcha v3

[](#configure-recaptcha-v3)

Create your keys on [Google reCaptcha](https://www.google.com/recaptcha) and set them in your `.env.local`:

```
RECAPTCHA3_KEY=your_site_key
RECAPTCHA3_SECRET=your_secret_key
```

Or store them via the ConfigBundle dashboard (`recaptcha3-site-key` and `recaptcha3-secret-key`).

### Override the layout template

[](#override-the-layout-template)

Create `templates/bundles/c975LContactFormBundle/layout.html.twig` and extend your own layout:

```
{% extends 'layout.html.twig' %}

{% set title = 'Contact' %}

{% block content %}
    {% block contactform_content %}
    {% endblock %}
{% endblock %}
```

The email templates are loaded from SiteBundle. Override them in `templates/c975LSiteBundle/emails/`.

---

Usage
-----

[](#usage)

The route name is `contactform_display`. Link to it from Twig:

```
{{ path('contactform_display') }}
```

### Pre-filling the subject

[](#pre-filling-the-subject)

Pass the `s` query parameter to pre-fill the subject field (rendered as read-only):

```
https://example.com/contact?s=My+Subject

```

### Rate limiting (optional)

[](#rate-limiting-optional)

If the following Symfony RateLimiter services are defined, they are automatically applied before any email is sent:

- `limiter.contact_form_by_ip`
- `limiter.contact_form_by_email`

Example (`config/packages/rate_limiter.yaml`):

```
framework:
    rate_limiter:
        contact_form_by_ip:
            policy: sliding_window
            limit: 5
            interval: '10 minutes'
        contact_form_by_email:
            policy: sliding_window
            limit: 3
            interval: '10 minutes'
```

### Honeypot and CSP

[](#honeypot-and-csp)

If you have disabled `unsafe-inline` for `style-src` in your Content Security Policy, add this rule to keep the honeypot hidden:

```
.sr-only {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
```

---

Events
------

[](#events)

Two events allow customization without modifying the bundle:

ConstantEvent nameFired when`ContactFormEvent::CREATE_FORM``c975l_contactform.create.form`The form is being built`ContactFormEvent::SEND_FORM``c975l_contactform.send.form`The form has been submitted and validated### Example: customize email on submission

[](#example-customize-email-on-submission)

```
namespace App\EventSubscriber;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use c975L\ContactFormBundle\Event\ContactFormEvent;

class ContactFormSubscriber implements EventSubscriberInterface
{
    public static function getSubscribedEvents(): array
    {
        return [
            ContactFormEvent::SEND_FORM => 'onSendForm',
        ];
    }

    public function onSendForm(ContactFormEvent $event): void
    {
        $subject = $event->getFormData()->getSubject();

        if (str_contains((string) $subject, 'some-keyword')) {
            $event->setEmailData([
                'subject'   => 'Custom email subject',
                'bodyEmail' => 'emails/custom_contact.html.twig',
                'bodyData'  => [],
            ]);

            // Or abort sending with an error code:
            // $event->setError('error.user_not_found');
        }
    }
}
```

### Override the redirect URL after submission

[](#override-the-redirect-url-after-submission)

```
public function onCreateForm(ContactFormEvent $event): void
{
    $event->getRequest()->getSession()->set('redirectUrl', 'https://example.com/thank-you');
}
```

---

If this bundle **saves you development time**, consider sponsoring via the **Sponsor** button at the top of the repository. Thank you!

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance99

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity85

Battle-tested with a long release history

 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 ~29 days

Recently: every ~8 days

Total

114

Last Release

3d ago

Major Versions

2.x-dev → v3.02019-07-15

v3.4.1 → v4.02021-10-11

v4.0.1 → v5.02022-07-24

5.x-dev → v6.02022-07-25

6.x-dev → v7.02024-01-15

PHP version history (5 changes)v1.0PHP &gt;=5.5.9

v2.0.4PHP ^7

v3.4PHP \*

v6.0PHP ^8

v7.0.2PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/5679e828a48e37afabd92da60ab8d78bf65a3bedc0f618ef3fddf92082840f52?d=identicon)[Laurent3170](/maintainers/Laurent3170)

---

Top Contributors

[![LaurentMarquet](https://avatars.githubusercontent.com/u/16478286?v=4)](https://github.com/LaurentMarquet "LaurentMarquet (119 commits)")

---

Tags

symfonysymfony-bundlesymfonybundlecontact

### Embed Badge

![Health badge](/badges/c975l-contactform-bundle/health.svg)

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

###  Alternatives

[kimai/kimai

Kimai - Time Tracking

4.8k8.7k1](/packages/kimai-kimai)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M378](/packages/easycorp-easyadmin-bundle)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1615.6k12](/packages/2lenet-crudit-bundle)[pumukit/pumukit

Media Portal

6014.4k44](/packages/pumukit-pumukit)[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.

3691.3k16](/packages/netgen-layouts-core)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1175.2k](/packages/rcsofttech-audit-trail-bundle)

PHPackages © 2026

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