PHPackages                             wc4b/sib-contact-form-integration - 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. [API Development](/categories/api)
4. /
5. wc4b/sib-contact-form-integration

ActiveCraft-plugin[API Development](/categories/api)

wc4b/sib-contact-form-integration
=================================

A contact form integration for the Send in Blue API

1.5.2(6y ago)079[4 PRs](https://github.com/WC4B/sib-contact-form-intrgration/pulls)MITPHP

Since Apr 13Pushed 3y ago1 watchersCompare

[ Source](https://github.com/WC4B/sib-contact-form-intrgration)[ Packagist](https://packagist.org/packages/wc4b/sib-contact-form-integration)[ RSS](/packages/wc4b-sib-contact-form-integration/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (8)Used By (0)

sib contact form integration plugin for Craft CMS 3.x
=====================================================

[](#sib-contact-form-integration-plugin-for-craft-cms-3x)

A contact form integration for the Send in Blue API

[![Screenshot](resources/img/plugin-logo.png)](resources/img/plugin-logo.png)

Requirements
============

[](#requirements)

This plugin requires Craft CMS 3.0.0-beta.23 or later.

Installation
============

[](#installation)

To install the plugin, follow these instructions.

1. Open your terminal and go to your Craft project:

    ```
     cd /path/to/project

    ```
2. Then tell Composer to load the plugin:

    ```
     composer require sib-contact-form-integration/sib-contact-form-integration

    ```
3. In the Control Panel, go to Settings → Plugins and click the “Install” button for sib-contact-form-integration.

craft sib contact form Overview
-------------------------------

[](#craft-sib-contact-form-overview)

This plugin is a fork of the [craftcms/contact-form](https://github.com/craftcms/contact-form) and uses its base contact form logic in to send emails via the users SMPT email settings. In adition to this this plugin has additional settings and logic to handle talking to the [Send In Blue API](https://developers.sendinblue.com/). This plugin lets you add contacts to your SendInBlue contact lists and add those contacts to mailing lists.

Configuring sib-contact-form-integration
========================================

[](#configuring-sib-contact-form-integration)

CMS Settings
------------

[](#cms-settings)

Within the craft CMS, go to the settings page and click on the `sib-contact-form-integration` settings. From here you can add your Send In Blue API Key as `SIB API Key` and the newsletter list ID's comma separated within the `SIB Lists` textbox.

Custom Logic
------------

[](#custom-logic)

To add custom logic the plugin has extended the `afterValidate` and `beforeSend` event hooks from original [craftcms/contact-form](https://github.com/craftcms/contact-form).

To use the following event hooks add them to a `sib-contact-form-integration.php` file in your projects `/config` directory.

e.g. `my-project/config/sib-contact-form-integration.php`

### afterValidate

[](#aftervalidate)

The plugin has the original `afterValidate` but uses the plugins namespacing. This is where you can add custom validation for your form elements. For example.

```
use wc4b\sibcontactformintegration\models\Submission;
use yii\base\Event;

Event::on(Submission::class, Submission::EVENT_AFTER_VALIDATE, function(Event $e) {
    /** @var Submission $submission */
    $submission = $e->sender;

    // Make sure that `message[fromName]` was filled in
    if (!isset($submission->fromName) || empty($submission->fromName)) {
        // Add the error
        // (This will be accessible via `message.getErrors('message.phone')` in the template.)
        $submission->addError('fromName', "Name cannot be blank");
    }

    // Make sure that `message[termsCondCheck]` was filled in
    if (!isset($submission->message['termsCondCheck']) || empty($submission->message['termsCondCheck'])) {
        // Add the error
        // (This will be accessible via `message.getErrors('message.phone')` in the template.)
        $submission->addError('message.termsCondCheck', "Please review our T'&C's");
    }
});

```

### beforeSend &amp; afterSend

[](#beforesend--aftersend)

The plugin has the original `beforeSend` but uses the plugins namespacing. The plugins has also added and extra `afterSend` event hook to use. This is where you can add custom validation for your form elements.

For example.

```
use wc4b\sibcontactformintegration\events\MailEvent;
use wc4b\sibcontactformintegration\Mailer;
use yii\base\Event;

Event::on(Mailer::class, Mailer::EVENT_BEFORE_SEND || Mailer::EVENT_AFTER_SEND , function(MailEvent $e) {

});

```

### beforeSignup &amp; afterSignup

[](#beforesignup--aftersignup)

In addition to the above the plugin also has event hooks when signing up users to the Send In Blue mailing lists.

For example.

```
use wc4b\sibcontactformintegration\events\SignupEvent;
use wc4b\sibcontactformintegration\Subscriber;
use yii\base\Event;

Event::on(Subscriber::class, Subscriber::EVENT_BEFORE_SIGNUP || Subscriber::EVENT_AFTER_SIGNUP  , function(SignupEvent $e) {

});

```

Using sib-contact-form-integration
----------------------------------

[](#using-sib-contact-form-integration)

You can use the contact form via a page submission as indictated in the [craftcms/contact-form](https://github.com/craftcms/contact-form) docs. That being said it is recomended to use a `Ajax` request to handle the form submission for increased user experience.

and example module might look like this

```
const contactFormSubmission = (function () {

    const axios = require('axios').default;
    const DOM = {};
    function init(formElement) {
        DOM.form  = formElement;
        addEvents();

    }
    function addEvents() {

        DOM.form.addEventListener("submit", function (e) {

            e.preventDefault();
            var data = new FormData(DOM.form)

            handleReset();

            axios.post('/', data)
                .then(function (response) {
                    if (response.data.errors) {
                        handleErrors(response.data);
                    }
                    else {
                        handleSuccess();
                    }
                })
                .catch(function (error) {
                    console.log(error);
                });
        });
    }

    function handleSuccess() {

        var submitButton = DOM.form.getElementsByClassName("submit-button");
        submitButton[0].classList.add("inactive");

        var success = DOM.form.getElementsByClassName("success-message");
        success[0].classList.add("active");

        var inputs = DOM.form.getElementsByClassName("form-input");

        for (let index = 0; index < inputs.length; index++) {
            var element = inputs[index];

            element.value = "";
            element.checked = false;

        }

    }

    function handleReset() {

        var errorMessages = DOM.form.getElementsByClassName("error-message");

        for (let index = 0; index < errorMessages.length; index++) {
            var element = errorMessages[index];
            element.innerHTML = "";
            element.classList.remove('active');
        }

    }

    function handleErrors(data) {

        if (data.errors) {
            Object.keys(data.errors).forEach(function (key) {
                var string = "";

                data.errors[key].forEach(function (e) {
                    string += "" + e + "";
                });

                var errorDivs = DOM.form.getElementsByClassName("error-message");
                var errorDiv = null;

                for (let index = 0; index < errorDivs.length; index++) {
                    const element = errorDivs[index];

                    if(element.id == key + ".errors"){
                        var errorDiv = element;
                        errorDiv.innerHTML = string;
                        errorDiv.classList.add('active');
                    }
                }

            });
        }

    }

    return {
        init: init
    };

})('Contact Form Submission');

document.addEventListener("DOMContentLoaded", function () {
    var form = document.getElementById("contact-form");
    if (form) {
        contactFormSubmission.init(form);
    }
});

```

With the following template

```

    {{ csrfInput() }}

            {{ message.message.body ?? '' }}

            I have read the and agree to the Privacy Policy

            I want to sign up to the newsletter

            Thanks for your message

            Subscribe

```

sib-contact-form-integration Roadmap
------------------------------------

[](#sib-contact-form-integration-roadmap)

Some things to do, and ideas for potential features:

- Option to make terms and conditions check mandatory

Brought to you by [WillCodeForBeer](https://github.com/WC4B/sib-contact-form-integration)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

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

Total

2

Last Release

2219d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1479785211a51dd37bd83c517507de14932c7b49503ce7b55d157005c113ca6e?d=identicon)[WillCodeforBeer](/maintainers/WillCodeforBeer)

---

Top Contributors

[![JoelBeer](https://avatars.githubusercontent.com/u/6808092?v=4)](https://github.com/JoelBeer "JoelBeer (21 commits)")

---

Tags

cmsCraftcraftcmscraft-pluginsib-contact-form-integration

### Embed Badge

![Health badge](/badges/wc4b-sib-contact-form-integration/health.svg)

```
[![Health](https://phpackages.com/badges/wc4b-sib-contact-form-integration/health.svg)](https://phpackages.com/packages/wc4b-sib-contact-form-integration)
```

###  Alternatives

[wrav/oembed

A simple plugin to extract media information from websites, like youtube videos, twitter statuses or blog articles.

36205.0k3](/packages/wrav-oembed)[craftpulse/craft-typesense

Craft Plugin that synchronises with Typesense

122.7k](/packages/craftpulse-craft-typesense)[jsmrtn/craftagram

Grab Instagram content through the Instagram API

141.3k](/packages/jsmrtn-craftagram)

PHPackages © 2026

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