PHPackages                             alexsabur/antispam-bundle - 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. [Templating &amp; Views](/categories/templating)
4. /
5. alexsabur/antispam-bundle

ActiveSymfony-bundle[Templating &amp; Views](/categories/templating)

alexsabur/antispam-bundle
=========================

This bundle provides some basic features to reduce spam in symfony forms.

3.0.0(1y ago)096↓75%MITPHPPHP ^8.1

Since May 23Pushed 1y ago1 watchersCompare

[ Source](https://github.com/AlexSabur/antispam-bundle)[ Packagist](https://packagist.org/packages/alexsabur/antispam-bundle)[ RSS](/packages/alexsabur-antispam-bundle/feed)WikiDiscussions master Synced 1mo ago

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

The original author has deleted the package, but it was used in local project.
==============================================================================

[](#the-original-author-has-deleted-the-package-but-it-was-used-in-local-project)

NucleosAntiSpamBundle
=====================

[](#nucleosantispambundle)

This bundle provides some basic features to reduce spam in Symfony. It is the successor of `core23/antispam-bundle`, but not related to `isometriks/spam-bundle`.

Features
--------

[](#features)

- **Honeypot protection for forms:** An additional "hidden" (i.e. made invisible with CSS) field will be added to your form. Whoever fills out this field, is considered to be a spam bot.
- **Time protection for forms:** The time between *displaying* the form and *submitting* the form is measured. Anybody who submits the form quicker than a certain number of seconds, is considered to be a spam bot. The timestamp is stored in the session.
- **Email address obfuscation filter for Twig:** To prevent spam harvest bots from detecting your email address, they are obfuscated by e.g. replacing `@` with `[AT]`. The filter will find email addresses automatically, so you can apply it to your entire text.

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

[](#installation)

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

```
composer require alexsabur/antispam-bundle

```

### Enable the Bundle

[](#enable-the-bundle)

In older versions of Symfony, you need to enable it manually:

```
// config/bundles.php

return [
    // ...
    Nucleos\AntiSpamBundle\NucleosAntiSpamBundle::class => ['all' => true],
];
```

Usage
-----

[](#usage)

### Form based protection

[](#form-based-protection)

In a controller:

```
$this->createForm(CustomFormType:class, null, [
    // Time protection
    'antispam_time'     => true,
    'antispam_time_min' => 10, // seconds
    'antispam_time_max' => 60,

    // Honeypot protection
    'antispam_honeypot'       => true,
    'antispam_honeypot_class' => 'hide-me',
    'antispam_honeypot_field' => 'email-repeat',
])
```

In a form class:

```
class MyType extends AbstractType
{
    // ...

    public function configureOptions(OptionsResolver $resolver): void
    {
        $resolver->setDefaults([
            // ...
            'antispam_time'     => true,
            'antispam_time_min' => 10,
            // same as above
        ]);
    }
}
```

### Twig email address obfuscation

[](#twig-email-address-obfuscation)

The Twig filter `antispam` replaces `@` by e.g. `[AT]`.

```
{# Replace plain text #}
{{ text|antispam }}

{# Replace rich text mails #}
{{ htmlText|antispam(true) }}
```

If you want a JavaScript decoding for the encoded email addresses, you should use the `AntiSpam.js` library:

```
document.addEventListener('DOMContentLoaded', () => {
  new AntiSpam('.custom_class');
});
```

It is recommended to use [webpack](https://webpack.js.org/) / [webpack-encore](https://github.com/symfony/webpack-encore)to include the JavaScript library in your page. This file is located in the `assets` folder.

### Configure the Bundle

[](#configure-the-bundle)

Create a configuration file called `nucleos_antispam.yaml`:

```
# config/packages/nucleos_antispam.yaml

nucleos_antispam:
    # Twig mail filter
    twig:
        mail:
            css_class: 'custom_class'
            at_text:   [ '[AT]', '(AT)', '[ÄT]' ]
            dot_text:  [ '[DOT]', '(DOT)', '[.]' ]

    # Time protection
    time:
        min: 5
        max: 3600
        global: true # This will add antispam to all forms

    # Honeypot protection
    honeypot:
        field: 'email_address'
        class: 'hidden'
        global: false
        provider: 'nucleos_antispam.provider.session'
```

License
-------

[](#license)

This bundle is under the [MIT license](LICENSE.md).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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

Unknown

Total

1

Last Release

726d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3e21453b68c4c530e157f96ec217a355c828cd6b821f1ec0cd8dd69f041fcbdc?d=identicon)[AlexSabur](/maintainers/AlexSabur)

---

Top Contributors

[![AlexSabur](https://avatars.githubusercontent.com/u/12692865?v=4)](https://github.com/AlexSabur "AlexSabur (1 commits)")

---

Tags

symfonybundletwigspamformantispamprotection

### Embed Badge

![Health badge](/badges/alexsabur-antispam-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/alexsabur-antispam-bundle/health.svg)](https://phpackages.com/packages/alexsabur-antispam-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[nucleos/antispam-bundle

This bundle provides some basic features to reduce spam in symfony forms.

52105.1k](/packages/nucleos-antispam-bundle)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)

PHPackages © 2026

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