PHPackages                             isapp/laravel-ai-spamdetector - 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. [Security](/categories/security)
4. /
5. isapp/laravel-ai-spamdetector

ActiveLibrary[Security](/categories/security)

isapp/laravel-ai-spamdetector
=============================

Laravel wrapper for AI SpamDetector – protect your contact forms from spam and bots using OpenAI GPT. Easy integration, smart filtering, and fully Laravel-native.

1.0.0(1y ago)00MITPHP

Since May 27Pushed 1y agoCompare

[ Source](https://github.com/isap-ou/laravel-ai-spamdetector)[ Packagist](https://packagist.org/packages/isapp/laravel-ai-spamdetector)[ RSS](/packages/isapp-laravel-ai-spamdetector/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

Laravel AI SpamDetector
=======================

[](#laravel-ai-spamdetector)

Laravel wrapper for [AI SpamDetector](https://github.com/isap-ou/ai-spamdetector) – protect your contact forms from spam and bots using OpenAI GPT. This package provides seamless Laravel integration for intelligent spam filtering with minimal setup.

[![AI SpamDetector](https://camo.githubusercontent.com/3c9c44c69f0e5a6e46b18028ad5487943c2960852733f2557880a51839d91ec1/68747470733a2f2f7374617469632e697361702e6d652f6c61726176656c2d61692d7370616d646574657263746f722e6a7067)](https://github.com/isap-ou/laravel-ai-spamdetector)[![Latest Version on Packagist](https://camo.githubusercontent.com/ad9de8a9e5d337455c723f42523613762d5fa8f1c596910be6aa1cc9bcc3697f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f69736170702f6c61726176656c2d61692d7370616d6465746563746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/isapp/laravel-ai-spamdetector)[![Total Downloads](https://camo.githubusercontent.com/e23f7e212b9e7cfacf1a007b6e804e1c7d6aaf62f1b48c592686be457eec6544/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f69736170702f6c61726176656c2d61692d7370616d6465746563746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/isapp/laravel-ai-spamdetector)

Features
--------

[](#features)

- 🧠 AI-based spam detection using OpenAI GPT
- ⚡️ Lightweight and efficient
- 🛠️ Simple configuration with `.env`

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

[](#installation)

```
composer require your-vendor/laravel-ai-spamdetector
```

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

[](#configuration)

You can configure the package in two ways:

### 1. Using `.env` variables (recommended for simple setups)

[](#1-using-env-variables-recommended-for-simple-setups)

Add the following to your `.env` file:

```
AI_SPAMDETECTOR_OPENAI_API_KEY=your-openai-api-key
AI_SPAMDETECTOR_OPENAI_ORGANIZATION=openai-organization-id
AI_SPAMDETECTOR_OPENAI_PROJECT=your-openai-project-id # Optional
AI_SPAMDETECTOR_OPENAI_BASE_URI=api.openai.com/v1 # Optional, defaults to OpenAI API
AI_SPAMDETECTOR_OPENAI_MODEL=gpt-4 # Optional, default is gpt-4
```

> 💡 If you already have `OPENAI_API_KEY` defined in your project, it will be used automatically — no need to duplicate it. Available fallback variables:
>
> - `OPENAI_API_KEY`
> - `OPENAI_ORGANIZATION`
> - `OPENAI_PROJECT`
> - `OPENAI_BASE_URI`
> - `OPENAI_MODEL`

### 2. Publishing the config file

[](#2-publishing-the-config-file)

If you need more control, publish the configuration file:

```
php artisan vendor:publish --provider="Isapp\LaravelAiSpamdetector\SpamDetectorServiceProvider"
```

Usage
-----

[](#usage)

### 1. Dependency Injection

[](#1-dependency-injection)

```
use Illuminate\Http\Request;
use Isapp\AiSpamdetector\SpamDetector;

public function index (Request $request, SpamDetector $spamDetector)
{
    $request->validate([
        'name' => 'required|string|max:255',
        'email' => 'required|string|max:255',
        'message' => 'required|string|max:255',
    ]);

    $formData = new \Isapp\AiSpamdetector\FormData(
        name: $request->input('name'),
        email: $request->input('email'),
        message: $request->input('message'),
        userAgent: $request->header('User-Agent')
    );

    $isNotSpam = $spamDetector->analyze($formData);

    if ($isNotSpam) {
        // Process the form submission
    } else {
        // Handle spam detection
    }

}
```

### 2. Facade Usage

[](#2-facade-usage)

```
use Illuminate\Http\Request;
use Isapp\LaravelAiSpamdetector\Facades\SpamDetector;

public function index (Request $request)
{
    $request->validate([
        'name' => 'required|string|max:255',
        'email' => 'required|string|max:255',
        'message' => 'required|string|max:255',
    ]);

    $formData = new \Isapp\AiSpamdetector\FormData(
        name: $request->input('name'),
        email: $request->input('email'),
        message: $request->input('message'),
        userAgent: $request->header('User-Agent')
    );

    $isNotSpam = SpamDetector::analyze($formData);

    if ($isNotSpam) {
        // Process the form submission
    } else {
        // Handle spam detection
    }

}
```

Contributing
------------

[](#contributing)

Please, submit bugs or feature requests via the [Github issues](https://github.com/isap-ou/laravel-ai-spamdetector/issues).

Pull requests are welcomed!

Thanks!

License
-------

[](#license)

This project is open-sourced software licensed under the [MIT License](https://opensource.org/licenses/MIT).

You are free to use, modify, and distribute it in your projects, as long as you comply with the terms of the license.

---

Maintained by [ISAPP](https://isapp.be) and [ISAP OÜ](https://isap.me).
Check out our software development services at [isap.me](https://isap.me).

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance46

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

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

404d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9bfb1eae1e3e43813da6740e5eaa39307a95db7561c2d27e7e8aa24233cdcbeb?d=identicon)[andrii-trush](/maintainers/andrii-trush)

---

Top Contributors

[![andrii-trush](https://avatars.githubusercontent.com/u/14265776?v=4)](https://github.com/andrii-trush "andrii-trush (4 commits)")

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/isapp-laravel-ai-spamdetector/health.svg)

```
[![Health](https://phpackages.com/badges/isapp-laravel-ai-spamdetector/health.svg)](https://phpackages.com/packages/isapp-laravel-ai-spamdetector)
```

###  Alternatives

[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k18.7M143](/packages/mews-purifier)[paragonie/ecc

PHP Elliptic Curve Cryptography library

24820.0k39](/packages/paragonie-ecc)

PHPackages © 2026

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