PHPackages                             kreatif/statamic-forms - 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. kreatif/statamic-forms

ActiveStatamic-addon[Utility &amp; Helpers](/categories/utility)

kreatif/statamic-forms
======================

Statamic forms addon to share base templates and common functionalities among different projects.

1.0.4(6mo ago)127[1 issues](https://github.com/kreatifIT/kreatif-form-mails/issues)MITPHP

Since Oct 27Pushed 6mo agoCompare

[ Source](https://github.com/kreatifIT/kreatif-form-mails)[ Packagist](https://packagist.org/packages/kreatif/statamic-forms)[ RSS](/packages/kreatif-statamic-forms/feed)WikiDiscussions main Synced 1mo ago

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

Kreatif Forms for Statamic
--------------------------

[](#kreatif-forms-for-statamic)

An configuration-driven addon for Statamic v5+ form submissions. Orchestrate complex post-submission workflows including emails, Iubenda consent tracking, and custom integrations—all from a central configuration file with priority-based execution, conditional logic, queue support, and comprehensive error handling.

### Key Features

[](#key-features)

#### Core Architecture

[](#core-architecture)

- **Action-Based System**: Trigger multiple actions for each form submission with priority-based execution
- **Centralized Configuration**: Manage all form logic from a single configuration file
- **Config Merging**: Seamlessly combines global, handler-specific, and form-specific (YAML) configurations
- **Interface-Driven**: All actions implement `FormActionInterface` for consistency and extensibility
- **Error Handling**: Comprehensive try-catch blocks with detailed logging and graceful degradation
- **Event System**: Extensible events for `FormProcessingStarted`, `FormProcessingCompleted`, `ActionExecuted`, and `ActionFailed`

#### Email Management

[](#email-management)

- **Statamic Email Control**: Optionally disable Statamic's default email sending (configurable globally or per-form)
- **Admin Notifications**: Send detailed submission notifications to administrators
- **Autoresponders**: Send confirmation emails to form submitters
- **Multiple Template Formats**: Support for HTML, Markdown, and plain text templates
- **Multiple Recipients**: Configure `to`, `cc`, `bcc`, and `replyTo` addresses
- **Dynamic Branding**: Configurable logos and organization names per form
- **Content Sanitization**: Built-in XSS protection for email content
- **Multilingual Support**: Full translation support for subjects and content

#### Advanced Features

[](#advanced-features)

- **Queue Support**: Queue any action for asynchronous execution with configurable connections, queues, and delays
- **Conditional Execution**: Execute actions based on submission data with powerful operators (equals, contains, in, empty, etc.)
- **Priority Control**: Define execution order with priority values (lower numbers run first)
- **Rate Limiting**: Prevent spam with configurable rate limits by IP, email, or session
- **Validation**: Built-in configuration validation for all actions
- **Action Results**: Structured result objects with success/failure states, data, and error messages

#### Built-in Actions

[](#built-in-actions)

- **SendAdminNotificationAction**: Email notifications to administrators (Priority: 50)
- **SendAutoresponderAction**: Confirmation emails to users (Priority: 60)
- **AddToIubendaAction**: Send consent to Iubenda Consent Database (Priority: 90)

Installation &amp; Setup
========================

[](#installation--setup)

1. Copy Addon: Place the entire kreatif/statamic-forms directory into your project's addons/ folder.
2. Autoload: Run composer dump-autoload from your project's root directory to make Statamic aware of the addon's classes.
3. Publish Assets: Publish the configuration file. This is the only mandatory step. Publishing views and language files is optional for customization.
4. ```
     # Publish the configuration file (required)
     php please vendor:publish --tag=kreatif-forms-config

     # Publish email templates (optional)
     php please vendor:publish --tag=kreatif-forms-views

     # Publish language files (optional)
     php please vendor:publish --tag=kreatif-forms-lang
    ```
5. Configure Environment: Add the necessary API keys and URLs to your project's .env file. ```
    # Required for Iubenda Action
    IUBENDA_CONSENT_DB_API_KEY="your_iubenda_public_key"

    # Optional: Set a global logo URL for emails
    FORM_EMAIL_LOGO_URL="https://your-cdn.com/logo.png"
    FORM_EMAIL_ORG_NAME="Your Company Name"
    ```

### Configuration

[](#configuration)

All addon logic is controlled via the `config/kreatif-statamic-forms.php` file.

#### Global Settings

[](#global-settings)

##### Disable Statamic's Default Email

[](#disable-statamics-default-email)

By default, Statamic will send its own emails based on the form's YAML configuration. You can disable this globally or per-form:

```
// Disable globally for all forms (can be overridden per form)
'disable_statamic_email' => false,

// Or per-form in handlers:
'handlers' => [
    'contact_form' => [
        'disable_statamic_email' => true, // This form's emails are handled by the addon
        'actions' => [...]
    ]
]
```

##### Logging Configuration

[](#logging-configuration)

Control how the addon logs form processing:

```
'logging' => [
    'enabled' => true,
    'channel' => null, // null uses default log channel
    'level' => 'info', // debug, info, warning, error
],
```

##### Email Settings

[](#email-settings)

These settings act as the default for all form handlers:

```
'email' => [
    'logo_url' => env('FORM_EMAIL_LOGO_URL', null),
    'organization_name' => env('FORM_EMAIL_ORG_NAME', config('app.name')),
    'sanitize_content' => true, // Prevent XSS in emails
],
```

#### Form Handlers

[](#form-handlers)

This is the core of the addon. Each key in the handlers array corresponds to a Statamic form handle.

```
'handlers' => [
    'contact_form' => [
        // Override global settings for this form
        'logo_url' => env('CONTACT_FORM_LOGO_URL'),
        'organization_name' => 'Your Company',
        'disable_statamic_email' => true,

        // Rate limiting (optional)
        'rate_limit' => [
            'enabled' => true,
            'max_attempts' => 5,
            'decay_minutes' => 60,
            'by' => 'ip', // 'ip', 'email', or 'session'
        ],

        // Define the actions to run for this form
        'actions' => [
            // ... actions are defined here ...
        ],
    ],
],
```

#### Action Configuration Options

[](#action-configuration-options)

All actions support these common configuration options:

OptionTypeDefaultDescription`enabled`bool`true`Enable or disable the action`priority`intAction-specificExecution priority (lower runs first)`queue`bool`false`Queue the action for async execution`queue_connection`string`default`Laravel queue connection to use`queue_name`string`default`Queue name`delay`int`0`Delay in seconds before queueing`when`array`null`Conditional execution based on submission data##### Queue Example

[](#queue-example)

Queue an action for asynchronous processing:

```
SendAdminNotificationAction::class => [
    'enabled' => true,
    'to' => 'admin@example.com',
    'queue' => true,
    'queue_connection' => 'redis',
    'queue_name' => 'emails',
    'delay' => 5, // Wait 5 seconds before processing
],
```

##### Conditional Execution

[](#conditional-execution)

Execute actions only when certain conditions are met:

```
SendAdminNotificationAction::class => [
    'enabled' => true,
    'to' => 'admin@example.com',
    'when' => [
        'field' => 'notify_admin',
        'operator' => '=',
        'value' => true,
    ],
],
```

**Supported Operators:**

- `=`, `==`, `equals` - Equal to
- `!=`, `not_equals` - Not equal to
- `===`, `strict_equals` - Strictly equal to
- `!==`, `strict_not_equals` - Strictly not equal to
- `>`, `greater_than` - Greater than
- `>=`, `greater_than_or_equal` - Greater than or equal to
- ` true,
    'priority' => 10, // Run this first
],
```

#### Rate Limiting

[](#rate-limiting)

Prevent spam submissions with rate limiting:

```
'handlers' => [
    'contact_form' => [
        'rate_limit' => [
            'enabled' => true,
            'max_attempts' => 5,      // Max 5 submissions
            'decay_minutes' => 60,    // Per 60 minutes
            'by' => 'ip',            // Rate limit by: 'ip', 'email', or 'session'
        ],
    ],
],
```

#### Available Actions

[](#available-actions)

`SendAdminNotificationAction` Sends a detailed notification email to administrators.

##### Configuration:

[](#configuration-1)

```
use Kreatif\StatamicForms\Actions\SendAdminNotificationAction;

SendAdminNotificationAction::class => [
'enabled' => true,
'to'      => 'admin@example.com, support@example.com', // Comma-separated string
'cc'      => 'manager@example.com',
'bcc'     => 'archive@example.com',
'from'    => 'noreply@yourdomain.com',
'reply_to'=> 'custom-reply@yourdomain.com', // If not set, defaults to the user's email
'subject' => 'translate:kreatif-forms::forms.new_submission_subject', // Translatable subject
],
```

`SendAutoresponderAction` sends a confirmation email to the user who submitted the form.

```
use Kreatif\StatamicForms\Actions\SendAutoresponderAction;

SendAutoresponderAction::class => [
'enabled' => true,
'from'    => 'support@yourdomain.com',
'subject' => 'Thanks for your message!',
// Optionally specify a custom template
'html'    => 'kreatif-forms::html.emails.special-autoresponder',
'text'    => 'kreatif-forms::text.emails.special-autoresponder',
],
```

`AddToIubendaAction` Sends consent data to the Iubenda Consent Database.

```
use Kreatif\StatamicForms\Actions\AddToIubendaAction;

AddToIubendaAction::class => [
    'enabled' => true,
    'preferences' => ['newsletter' => true],
    'field_mapping' => [
        // Iubenda API Key => Your Form Field Handle
        'first_name' => 'vorname',
        'last_name'  => 'nachname',
        'email'      => 'email_address',
    ],
],
```

Advanced Mapping Tip: If your form only has a single `name` field, you can map it like this. The addon will automatically split it into a first and last name.

```
'field_mapping' => [
    'first_name' => 'full_name', // Map the full name field
    'last_name'  => null,      // Set last_name to null
    'email'      => 'email',
],
```

### Usage Examples

[](#usage-examples)

##### Example 1: Standard Contact Form

[](#example-1-standard-contact-form)

Your addon config controls everything. The form's YAML is minimal.

`config/kreatif-statamic-forms.php`:

```
'handlers' => [
    'contact' => [
        'actions' => [
            SendAdminNotificationAction::class => ['enabled' => true, 'to' => 'admin@site.com'],
            SendAutoresponderAction::class => ['enabled' => true],
        ],
    ],
],
```

`resources/forms/a_form.yaml`:

```
title: Contact
# No email section needed!
```

##### Example 2: Overriding with Form YAML

[](#example-2-overriding-with-form-yaml)

The form's YAML configuration takes priority over the addon's action config. This is useful for client-managed forms. `config/kreatif-statamic-forms.php`:

```
'handlers' => [
    'inquiries' => [
        'actions' => [
            // This action will run, but its 'to' and 'subject' will be overridden
            SendAdminNotificationAction::class => ['enabled' => true, 'to' => 'fallback@site.com'],
        ],
    ],
],
```

`resources/forms/inquiries.yaml`

```
:title: Inquiries
email:
  -
    to: 'client-managed-email@site.com' # This email will be used
    subject: 'A New Inquiry has Arrived!' # This subject will be used
```

#### Example 3: API-Only Form (Iubenda)

[](#example-3-api-only-form-iubenda)

This setup uses the addon to send data to Iubenda but lets Statamic's default mailer handle the emails. This is achieved by not including the email actions in the handler.

`config/kreatif-statamic-forms.php`:

```
 'handlers' => [
    'newsletter_signup' => [
        'actions' => [
            // Only the Iubenda action is defined
            AddToIubendaAction::class => ['enabled' => true],
        ],
    ],
],
```

`resources/forms/newsletter_signup.yaml`:

```
title: Newsletter Signup
# Statamic's mailer will run because the addon doesn't stop it
email:
-
    to: 'marketing@site.com'
    subject: 'New Newsletter Subscriber'
```

### Events System

[](#events-system)

The addon dispatches events throughout the form processing lifecycle. You can listen to these events to add custom logic:

#### Available Events

[](#available-events)

- **`FormProcessingStarted`** - Dispatched when form processing begins

    - Properties: `Submission $submission`, `array $actions`
- **`FormProcessingCompleted`** - Dispatched when all actions have been executed

    - Properties: `Submission $submission`, `array $results`
- **`ActionExecuted`** - Dispatched when an action succeeds

    - Properties: `string $actionClass`, `Submission $submission`, `ActionResult $result`
- **`ActionFailed`** - Dispatched when an action fails

    - Properties: `string $actionClass`, `Submission $submission`, `ActionResult $result`

#### Example: Listen to Events

[](#example-listen-to-events)

Create a listener in your application:

```
namespace App\Listeners;

use Kreatif\StatamicForms\Events\ActionFailed;
use Illuminate\Support\Facades\Log;

class LogFailedFormActions
{
    public function handle(ActionFailed $event): void
    {
        Log::critical('Form action failed', [
            'action' => $event->actionClass,
            'form' => $event->submission->form()->handle(),
            'errors' => $event->result->getErrors(),
        ]);

        // Maybe send alert to monitoring service
        // Sentry::captureMessage('Form action failed');
    }
}
```

Register in `EventServiceProvider`:

```
protected $listen = [
    \Kreatif\StatamicForms\Events\ActionFailed::class => [
        \App\Listeners\LogFailedFormActions::class,
    ],
];
```

### Creating Custom Actions

[](#creating-custom-actions)

You can easily create custom actions by implementing `FormActionInterface` or extending `BaseAction`:

```
namespace App\FormActions;

use Kreatif\StatamicForms\Actions\BaseAction;
use Kreatif\StatamicForms\Contracts\ActionResult;
use Statamic\Forms\Submission;

class SendToCustomCrmAction extends BaseAction
{
    protected function handle(Submission $submission, array $config): ActionResult
    {
        $apiKey = $config['api_key'] ?? env('CRM_API_KEY');
        $endpoint = $config['endpoint'] ?? 'https://crm.example.com/api/contacts';

        // Your custom logic here
        $response = Http::post($endpoint, [
            'api_key' => $apiKey,
            'name' => $submission->get('name'),
            'email' => $submission->get('email'),
        ]);

        if ($response->failed()) {
            return ActionResult::failure(
                errors: [$response->body()],
                message: 'Failed to send to CRM'
            );
        }

        return ActionResult::success(
            data: $response->json(),
            message: 'Successfully sent to CRM'
        );
    }

    public function validate(array $config): bool
    {
        return !empty($config['api_key'] ?? env('CRM_API_KEY'));
    }

    public function getPriority(): int
    {
        return 95; // Run after most other actions
    }
}
```

Then use it in your config:

```
use App\FormActions\SendToCustomCrmAction;

'handlers' => [
    'contact_form' => [
        'actions' => [
            SendToCustomCrmAction::class => [
                'enabled' => true,
                'api_key' => env('CRM_API_KEY'),
                'endpoint' => 'https://crm.example.com/api/contacts',
            ],
        ],
    ],
],
```

### Email Preview Feature

[](#email-preview-feature)

Preview and test email templates before sending them to actual recipients.

#### Access Preview

[](#access-preview)

Navigate to **Tools → Form Email Preview** in the Statamic Control Panel, or click "Preview Email Templates" from any form's submissions listing.

**Permissions**: Requires `view kreatif-forms email previews` permission.

#### Features

[](#features)

- **Preview Index**: View all forms with email actions and their status
- **Direct Preview**: Preview admin notifications and autoresponders with sample data
- **Template Editor**: Interactive editor to customize sample data and preview both email types
- **Multiple Formats**: View HTML and plain text versions

#### Quick Preview URLs

[](#quick-preview-urls)

```
/cp/kreatif-forms/preview                          # List all forms
/cp/kreatif-forms/preview/{formHandle}/admin       # Admin notification preview
/cp/kreatif-forms/preview/{formHandle}/autoresponder  # Autoresponder preview
/cp/kreatif-forms/preview/{formHandle}/template    # Template editor

```

Add `?format=text` to any preview URL to see the plain text version.

#### How It Works

[](#how-it-works)

The preview controller automatically generates intelligent sample data based on your form's blueprint:

- Field types are detected and appropriate sample values are generated
- Smart pattern matching for common fields (name, email, company, etc.)
- Respects all configuration settings (logo, branding, excluded fields)
- Merges configs the same way live submissions do

How to Install
--------------

[](#how-to-install)

You can install this addon via Composer:

```
composer require kreatif/forms
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance47

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

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

Total

4

Last Release

194d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c58db6e153a58764dfc820c0a9d33b0a64a26b62eb8c0051912a20edb63b6499?d=identicon)[kreatif](/maintainers/kreatif)

---

Tags

Formsstatamic

### Embed Badge

![Health badge](/badges/kreatif-statamic-forms/health.svg)

```
[![Health](https://phpackages.com/badges/kreatif-statamic-forms/health.svg)](https://phpackages.com/packages/kreatif-statamic-forms)
```

###  Alternatives

[aerni/livewire-forms

A Statamic forms framework powered by Laravel Livewire

2912.8k](/packages/aerni-livewire-forms)[visuellverstehen/statamic-classify

A useful helper to add CSS classes to all HTML tags generated by the bard editor.

20116.8k](/packages/visuellverstehen-statamic-classify)[marcorieser/statamic-livewire

A Laravel Livewire integration for Statamic.

2381.5k10](/packages/marcorieser-statamic-livewire)[withcandour/aardvark-seo

Save time and get your Statamic site to rank better with the SEO addon for Statamic.

13128.3k](/packages/withcandour-aardvark-seo)[mitydigital/feedamic

A fully-featured RSS and Atom feed generator for Statamic.

1064.0k](/packages/mitydigital-feedamic)[aryehraber/statamic-captcha

Protect your Statamic forms using a Captcha service

16194.4k](/packages/aryehraber-statamic-captcha)

PHPackages © 2026

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