PHPackages                             tobento/app-spam - 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. tobento/app-spam

ActiveLibrary

tobento/app-spam
================

App spam protection.

2.0(7mo ago)031MITPHPPHP &gt;=8.4

Since Aug 7Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/tobento-ch/app-spam)[ Packagist](https://packagist.org/packages/tobento/app-spam)[ Docs](https://www.tobento.ch)[ RSS](/packages/tobento-app-spam/feed)WikiDiscussions 2.x Synced 1mo ago

READMEChangelog (2)Dependencies (13)Versions (4)Used By (0)

App Spam
========

[](#app-spam)

Spam protection for forms and detecting spam using the validator.

Table of Contents
-----------------

[](#table-of-contents)

- [Getting Started](#getting-started)
    - [Requirements](#requirements)
- [Documentation](#documentation)
    - [App](#app)
    - [Spam Boot](#spam-boot)
        - [Spam Config](#spam-config)
    - [Basic Usage](#basic-usage)
        - [Render Detector](#render-detector)
        - [Detect Spam](#detect-spam)
    - [Available Detectors](#available-detectors)
        - [Composite Detector](#composite-detector)
        - [EmailDomain Detector](#emaildomain-detector)
        - [EmailRemote Detector](#emailremote-detector)
        - [Honeypot Detector](#honeypot-detector)
        - [MinTimePassed Detector](#mintimepassed-detector)
        - [Null Detector](#null-detector)
        - [WithoutUrl Detector](#withouturl-detector)
    - [Available Factories](#available-factories)
        - [Composite Factory](#composite-factory)
        - [EmailRemote Factory](#emailremote-factory)
        - [Honeypot Factory](#honeypot-factory)
        - [MinTimePassed Factory](#mintimepassed-factory)
        - [Named Factory](#named-factory)
        - [WithoutUrl Factory](#withouturl-factory)
    - [Register Named Detectors](#register-named-detectors)
    - [Manually Detecting Spam](#manually-detecting-spam)
    - [Detecting Spam Using Validator](#detecting-spam-using-validator)
    - [Http Spam Error Handler Boot](#http-spam-error-handler-boot)
    - [Events](#events)
- [Credits](#credits)

---

Getting Started
===============

[](#getting-started)

Add the latest version of the app spam project running this command.

```
composer require tobento/app-spam

```

Requirements
------------

[](#requirements)

- PHP 8.4 or greater

Documentation
=============

[](#documentation)

App
---

[](#app)

Check out the [**App Skeleton**](https://github.com/tobento-ch/app-skeleton) if you are using the skeleton.

You may also check out the [**App**](https://github.com/tobento-ch/app) to learn more about the app in general.

Spam Boot
---------

[](#spam-boot)

The spam boot does the following:

- installs and loads spam config file
- implements spam interfaces

```
use Tobento\App\AppFactory;
use Tobento\App\Spam\DetectorsInterface;

// Create the app
$app = new AppFactory()->createApp();

// Add directories:
$app->dirs()
    ->dir(realpath(__DIR__.'/../'), 'root')
    ->dir(realpath(__DIR__.'/../app/'), 'app')
    ->dir($app->dir('app').'config', 'config', group: 'config')
    ->dir($app->dir('root').'public', 'public')
    ->dir($app->dir('root').'vendor', 'vendor');

// Adding boots:
$app->boot(\Tobento\App\Spam\Boot\Spam::class);
$app->booting();

// Implemented interfaces:
$detectors = $app->get(DetectorsInterface::class);

// Run the app
$app->run();
```

### Spam Config

[](#spam-config)

The configuration for the spam is located in the `app/config/spam.php` file at the default App Skeleton config location where you can specify detectors for your application.

Basic Usage
-----------

[](#basic-usage)

### Render Detector

[](#render-detector)

In your view file, render the detector on your form using the `spamDetector` view macro:

```
