---
title: "Contact Form"
description: "Contact Form"
type: "docs"
category: "doc"
tags: [php]
authors: [Anonymous]
date: "2026-09-09"
last_update: "2026-09-09"
time_minutes: 2
draft: false
unlisted: false
url: "https://www.derafu.dev/docs/ui/contact-form"
---

# Contact Form

![GitHub last commit](https://img.shields.io/github/last-commit/derafu/contact-form/main)
![CI Workflow](https://github.com/derafu/contact-form/actions/workflows/ci.yml/badge.svg?branch=main&event=push)
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/derafu/contact-form)
![GitHub Issues](https://img.shields.io/github/issues-raw/derafu/contact-form)
![Total Downloads](https://poser.pugx.org/derafu/contact-form/downloads)
![Monthly Downloads](https://poser.pugx.org/derafu/contact-form/d/monthly)

## Requirements

The`derafu/form` and `derafu/data-processor` packages installed and configured in `services.yaml`.

Check the configuration in the [website skeleton](https://github.com/derafu/website/blob/main/config/services.yaml).

## Quick Start

Install the package:

```shell
composer require derafu/contact-form
```

Import the routes to your `routes.yaml`:

```yaml
imports:
    - { resource: '../vendor/derafu/contact-form/resources/config/contact-form-routes.yaml' }
```

Import the services to your `services.yaml`:

```yaml
imports:
    - { resource: '../vendor/derafu/contact-form/resources/config/contact-form-services.yaml' }
```

Copy the `templates/contact/index.html.twig` and `templates/contact/success.html.twig` to your project.

If you want to use the default templates (and not copy them), add the templates path to your service configuration:

```yaml
Derafu\Renderer\Contract\RendererInterface:
    factory: ['Derafu\Renderer\Factory\RendererFactory', 'create']
    lazy: true
    arguments:
        $options:
            paths:
                - '%kernel.project_dir%/vendor/derafu/contact-form/resources/templates'
```

Configure the environment variables:

```yaml
# Source of the form for identifying it in the webhook.
# Useful for multiple forms in the same webhook.
FORM_CONTACT_SOURCE=derafu.dev

# URL and secret key for processing the contact form.
# Get the URL from the webhook service you are using.
# The secret key will be used to sign the payload using HMAC.
FORM_CONTACT_WEBHOOK_URL=
FORM_CONTACT_WEBHOOK_SECRET_KEY=

# Site and secret key for protect forms with captcha.
# Get the keys from https://www.hcaptcha.com/
CAPTCHA_SITE_KEY=
CAPTCHA_SECRET_KEY=
```



---
Last updated on 09/09/2026
#php
