concept7 / statamic-mailerlite-connector
A Statamic form connector that subscribes form submissions to MailerLite, with per-connection field mapping and groups.
Package info
github.com/concept7/statamic-mailerlite-connector
Type:statamic-addon
pkg:composer/concept7/statamic-mailerlite-connector
Fund package maintenance!
Requires
- php: ^8.4
- illuminate/contracts: ^12.0||^13.0
- mailerlite/mailerlite-php: ^1.2
- statamic/cms: ^6.44
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.14
- mockery/mockery: ^1.6
- nunomaduro/collision: ^8.8
- orchestra/testbench: ^11.1.0||^10.0.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
MailerLite Connector for Statamic
A Statamic form connector that subscribes form submissions to MailerLite. Connect a form on its Connect tab, map MailerLite fields to values from the submission, and pick the groups subscribers are added to.
Requirements
- PHP 8.4+
- Statamic 6.44+ (form connectors)
- Laravel 12 or 13
- A queue worker, or the
syncqueue driver
Installation
composer require concept7/statamic-mailerlite-connector
Configuration
Add your MailerLite API key in the Control Panel under Tools → Addons → MailerLite Connector → Settings. Create a key in MailerLite under Integrations → MailerLite API.
The key is stored in resources/addons/statamic-mailerlite-connector.yaml. Without a key, MailerLite connections are skipped and the Connect tab asks for one.
Usage
Open a form in the Control Panel, go to Connect and add a MailerLite connection:
- Fields: each row sends a value to one MailerLite subscriber field. Type
@in the value to insert a form field, such as@email, or combine fields and text:@first_name @last_name. A row for Email is required; every other row is optional. - Groups: subscribers are added to these groups. Leave empty to only create or update the subscriber.
- Conditions: like every connection, a MailerLite connection can be sent always, or only when the submission matches conditions, for example when a consent checkbox is ticked.
A form can have several MailerLite connections, for example one per group with its own conditions.
The connection is stored on the form itself:
connections: mailerlite: - id: aB3dE5fG fields: - { id: r1, key: email, value: '[[email]]' } - { id: r2, key: name, value: '[[name]]' } - { id: r3, key: company, value: '[[organization]]' } groups: - '123456789'
How it works
When a submission is finalized (not for spam), every matching MailerLite connection queues a job. The job resolves the mapped values, leaves out empty ones, and calls MailerLite's create or update subscriber endpoint through the MailerLite PHP SDK. Existing subscribers are updated and added to the groups. For submissions from the site, the visitor's IP address is sent along.
| MailerLite response | What happens |
|---|---|
| Success | Done |
| Validation error (422) | Logged with the rejected field names, not retried |
| Rate limited (429) | Retried after the Retry-After delay |
| Refused key (401/403) or another client error | Logged, not retried |
| Server error (5xx) or network error | Retried up to 3 times |
Submission values are never written to the log. The queued job is encrypted.
Testing
composer test
composer analyse
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.

