PHPackages                             nstcactus/craft-contact-form-settings-module - 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. nstcactus/craft-contact-form-settings-module

ActiveCraft-module[Utility &amp; Helpers](/categories/utility)

nstcactus/craft-contact-form-settings-module
============================================

A Craft module to manage multiple contact forms using the contact-form &amp; contact-form-extensions plugins

2.0.0(7mo ago)0542MITPHP

Since Jan 10Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/nstCactus/craft-contact-form-settings-module)[ Packagist](https://packagist.org/packages/nstcactus/craft-contact-form-settings-module)[ RSS](/packages/nstcactus-craft-contact-form-settings-module/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (5)Used By (0)

ContactFormSettings module for Craft CMS
========================================

[](#contactformsettings-module-for-craft-cms)

This module helps to manage multiple sets of settings form the Craft `contact-form` &amp; `contact-form-extensions` plugins.

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

[](#requirements)

This module requires:

- PHP 7.1 or later
- Craft CMS 3, 4 or 5
- contact-form plugin 2.2 or later
- \[optional\] contact-form-extensions plugin 1.2.1 or later

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

[](#installation)

1. Install the composer module : `composer require nstcactus/craft-contact-form-settings-module`
2. Add the contents of the `app.php` file to your `config/app.php` (or just copy it there if it does not exist). This ensures that your module will get loaded for each request.

    The file might look something like this:

    ```
    return [
        'modules' => [
            'contact-form-settings-module' => [
                'class' => \nstcactus\craftcms\modules\contactFormSettings\ContactFormSettingsModule::class,
                'components' => [
                    // More on this below
                ],
            ],
        ],
        'bootstrap' => ['contact-form-settings-module'],
    ];
    ```

Add a form
----------

[](#add-a-form)

1. Create a form class that extends `\modules\contactFormSettings\forms\AbstractContactForm`. This class will describe the settings of your form.
2. Register this form class in the `config/app.php` file: add an entry in the `components` array of the module where the key is the form name and the value is a reference to the form class.

    Example:

    ```
    return [
        'modules' => [
            'contact-form-settings-module' => [
                'class' => \nstcactus\craftcms\modules\contactFormSettings\ContactFormSettingsModule::class,
                'components' => [
                    'contact' => \project\modules\app\forms\ContactForm::class,
                ],
            ],
        ],
        'bootstrap' => ['contact-form-settings-module'],
    ];
    ```
3. Add the following in the template of the form, inside the `` element: `{{ formNameInput('contact') }}`

Form settings
-------------

[](#form-settings)

### Plugin settings override

[](#plugin-settings-override)

Each form setting class must implement the `getContactFormConfiguration()` &amp; `getContactFormExtensionsConfiguration()`methods. They expect a return value that is a settings array, just like what would be set in the `config/contact-form.php` &amp; `contact-form-extensions.php`.

### Custom validation

[](#custom-validation)

Custom validation rules should be defined by overriding the `afterValidateSubmission()` method. Here you can add validation errors on the `Submission` instance (available in `$e->sender`) like so:

```
public function afterValidateSubmission(Event $e): void
{
    /** @var Submission $submission */
    $submission = $e->sender;

    if (empty($submission->message['FirstName'])) {
        $submission->addError('message.FirstName', Craft::t('site', 'This field cannot be blank.'));
    }
}
```

### FAQ

[](#faq)

#### How do I safely let the use pick from a list of subjects?

[](#how-do-i-safely-let-the-use-pick-from-a-list-of-subjects)

When the subject is selected by the user in a `` element for example, the recommended approach is

#### How do I set the recipient dynamically?

[](#how-do-i-set-the-recipient-dynamically)

To set the recipient dynamically, you can either:

- set it in the `toEmail` property in the array return from the `getContactFormSetting()` method
- set it using the [`contact-form-extensions` override mechanism](https://github.com/hybridinteractive/craft-contact-form-extensions?tab=readme-ov-file#overriding-where-the-message-is-sent)in either the `beforeValidateSubmission()` or the `afterValidateSubmission()` method. Example:

    ```
    public function beforeValidateSubmission(ModelEvent $e): void
    {
      parent::beforeValidateSubmission($e);
      $submission = $e->sender->message['toEmail'] = Craft::$app->getSecurity()->hashData($subject->contactSubjectRecipient);
    }
    ```

#### How do I use separate fields for first name &amp; last name?

[](#how-do-i-use-separate-fields-for-first-name--last-name)

When using separate first &amp; last name field as opposed to a single `fromName` field, make sure to actually set the `fromName` property of the `Submission` instance in the `afterValidateSubmission()` method.

This will improve submission index in the control panel.

Example:

```
public function afterValidateSubmission(Event $e): void
{
    /** @var Submission $submission */
    $submission = $e->sender;

    if (!empty($submission->message['FirstName']) || empty($submission->message['LastName'])) {
        $submission->fromName = trim(sprintf(
            '%s %s',
            $submission->message['FirstName'] ?? '',
            $submission->message['LastName'] ?? ''
        ));
    }
}
```

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance64

Regular maintenance activity

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

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

Total

4

Last Release

221d ago

Major Versions

1.1.0 → 2.0.02025-10-03

### Community

Maintainers

![](https://www.gravatar.com/avatar/53cf2ceb2a348849e2038a7eb2e32f0782ea0ea31a468da7661fcbf18420fac6?d=identicon)[nstcactus](/maintainers/nstcactus)

---

Top Contributors

[![nstCactus](https://avatars.githubusercontent.com/u/353843?v=4)](https://github.com/nstCactus "nstCactus (8 commits)")

### Embed Badge

![Health badge](/badges/nstcactus-craft-contact-form-settings-module/health.svg)

```
[![Health](https://phpackages.com/badges/nstcactus-craft-contact-form-settings-module/health.svg)](https://phpackages.com/packages/nstcactus-craft-contact-form-settings-module)
```

###  Alternatives

[mcp/sdk

Model Context Protocol SDK for Client and Server applications in PHP

1.4k423.9k30](/packages/mcp-sdk)[soyuka/pmu

PHP Mono Repository Utility

771.6M5](/packages/soyuka-pmu)[albertofem/rsync-lib

A simple PHP rsync wrapper library

93394.2k5](/packages/albertofem-rsync-lib)[lillik/magento2-price-decimal

Magento 2 Price Decimal Precision

111147.5k](/packages/lillik-magento2-price-decimal)[mokhosh/filament-rating

Add rating fields and columns to Filament forms and tables

82117.9k1](/packages/mokhosh-filament-rating)[aeon-php/business-hours

Abstraction allowing to define and check against business hours

10135.8k](/packages/aeon-php-business-hours)

PHPackages © 2026

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