PHPackages                             makeitfly/cleantalk-symfony - 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. makeitfly/cleantalk-symfony

ActiveSymfony-bundle

makeitfly/cleantalk-symfony
===========================

Cleantalk anti-spam integration for Symfony

0.1.0(4y ago)0200MITPHPPHP &gt;=7.4

Since Jan 6Pushed 4y ago2 watchersCompare

[ Source](https://github.com/makeitfly/cleantalk-symfony)[ Packagist](https://packagist.org/packages/makeitfly/cleantalk-symfony)[ RSS](/packages/makeitfly-cleantalk-symfony/feed)WikiDiscussions main Synced 1mo ago

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

Cleantalk Symfony bundle
========================

[](#cleantalk-symfony-bundle)

Unofficial [Cleantalk](https://cleantalk.org/) anti-spam integration for Symfony. Currently only provides the most basic anti-spam protection, as per the docs of the [php-antispam](https://github.com/CleanTalk/php-antispam)package.

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

[](#installation)

Make sure Composer is installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

By default your Symfony application automatically performs a `cache:clear` after a `composer require`. We haven't submitted a Flex recipe (yet), so this will error out because of missing configuration. For now, ideally create the config file before you require the bundle, as per the [configuration section](#configuration).

### Applications that use Symfony Flex

[](#applications-that-use-symfony-flex)

Open a command console, enter your project directory and execute:

```
$ composer require makeitfly/cleantalk-symfony
```

### Applications that don't use Symfony Flex

[](#applications-that-dont-use-symfony-flex)

#### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
$ composer require makeitfly/cleantalk-symfony
```

#### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Then, enable the bundle by adding it to the list of registered bundles in the `config/bundles.php` file of your project:

```
// config/bundles.php

return [
    // ...
    MakeItFly\CleanTalkBundle\MakeItFlyCleanTalkBundle::class => ['all' => true],
];
```

Configuration
-------------

[](#configuration)

All you need is the auth key, which you can find in your CleanTalk dashboard.

```
# config/packages/makeitfly_cleantalk.yaml
makeitfly_cleantalk:
    enabled: true
    auth_key: '%env(MAKEITFLY_CLEANTALK_AUTH_KEY)%'

    # Other optional config.
    server_url: "https://moderate.cleantalk.org/api2.0/" # CleanTalk API endpoint
    agent: "makeitfly-symfony" # Sent on every API request
```

It is recommended to create a development configuration that disables the validation for your development environment.

```
# config/packages/dev/makeitfly_cleantalk.yaml
makeitfly_cleantalk:
    enabled: false
```

Usage
-----

[](#usage)

Add the `CleanTalkType` as a field to your form. It automatically defines a constraint that will be validated when you call `$form->isValid()`.

Example usage:

```
public function buildForm(
    FormBuilderInterface $builder,
    array $options
): void {
    $builder
        ->add('message', TextareaType::class, [
            'label' => 'form.contact.message.label'
        ])
        ->add('email', EmailType::class, [
            'label' => 'form.contact.email.label'
        ])
        ->add('cleantalk', CleanTalkType::class, [
            'sender_email_field' => 'email',
            'message_field' => 'message'
        ]);
}
```

### Passing form data

[](#passing-form-data)

The CleanTalk API checks if a message is spam based on the submitted form values. The sender email is the only required field, but it is recommended to pass as much data as you have for better spam detection.

When you configure these fields as a string, the library will use these to fetch the data from the form data. This requires the `symfony/property-access` to be installed.

Alternatively you can use a callback function to return a custom value yourself.

```
// Minimal configuration:
$builder->add('cleantalk', CleanTalkType::class, [
    'sender_email_field' => 'email', // Required
]);

// Full configuration:
$builder->add('cleantalk', CleanTalkType::class, [
    // One of CleanTalkCheck::MESSAGE or CleanTalkCheck::USER. This defines
    // which CleanTalk API endpoint is used:
    // @see https://cleantalk.org/help/api-check-message
    // @see https://cleantalk.org/help/api-check-newuser
    'check_type' => CleanTalkCheck::MESSAGE,
    // The email address of the person who submits the form. This will be
    // fetched from the 'someProperty' property of the form data.
    'sender_email_field' => 'someProperty',
    // Alternatively, for this and the following properties you can use a
    // callable instead, which will get passed the form data.
    'sender_email_field' => function ($formData) {
        // Use the form data directly here, or for example fetch the current
        // logged in account and get the email that way.
        return $formData->getEmail();
    },
    'sender_nickname_field' => 'senderNickname',
    'phone_field' => 'phone',
    'message_field' => 'message'
]);
```

### Roadmap

[](#roadmap)

Following points are nice-to-haves:

- Cleantalk returns why a submission is refused. This could be logged.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

1588d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4e5db0e8c786f8e48872431f833a215d8f58d5bced2aae66989e936cd171d985?d=identicon)[mark-gerarts](/maintainers/mark-gerarts)

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

---

Top Contributors

[![mark-gerarts](https://avatars.githubusercontent.com/u/11940560?v=4)](https://github.com/mark-gerarts "mark-gerarts (2 commits)")

### Embed Badge

![Health badge](/badges/makeitfly-cleantalk-symfony/health.svg)

```
[![Health](https://phpackages.com/badges/makeitfly-cleantalk-symfony/health.svg)](https://phpackages.com/packages/makeitfly-cleantalk-symfony)
```

###  Alternatives

[cleantalk/yii2-antispam

Anti-spam yii2 extension by CleanTalk with protection against spam bots and manual spam

1018.0k](/packages/cleantalk-yii2-antispam)

PHPackages © 2026

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