PHPackages                             naif/ai-validation - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. naif/ai-validation

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

naif/ai-validation
==================

AI Validator for Laravel: Uses ChatGPT (GPT-3.5-turbo) to easily check and filter user inputs.

410PHP

Since Jan 22Pushed 2y ago1 watchersCompare

[ Source](https://github.com/naifalshaye/ai-validation)[ Packagist](https://packagist.org/packages/naif/ai-validation)[ RSS](/packages/naif-ai-validation/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

AI Validation
=============

[](#ai-validation)

AI Validator for Laravel: Uses ChatGPT (GPT-3.5-turbo) to easily check and filter user inputs.

### Requirements

[](#requirements)

- PHP 7.2 or higher
- Laravel 6.0 or higher
- Open AI API Key

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

[](#installation)

You can install the package into a Laravel app via composer:

```
composer require naif/ai-validation
```

### Publish config file

[](#publish-config-file)

```
php artisan vendor:publish --provider="Naif\AIValidation\AIValidationServiceProvider"

```

#### OpenAI API Key

[](#openai-api-key)

Create your API Key from

Add API Key in .env file

```
CHATGPT_API_KEY=

```

Usage
-----

[](#usage)

Field validation rule

```
use Naif\AIValidation\Rules\AIValidation;

$request->validate([
    'field_name' => [AIValidation::make('ads')],
]);

```

Supported Validation Types
--------------------------

[](#supported-validation-types)

- **Spam**: Identifies unsolicited, bulk, or irrelevant messages.
- **Nonsense**: Flags text that is illogical or meaningless.
- **Botcheck**: Detects text likely generated by automated bots.
- **Emoji Overuse**: Catches excessive use of emojis in text.
- **Promotional**: Highlights promotional or advertising content.
- **Ads**: Identifies content that is explicitly advertising.
- **Swearing**: Flags use of profanity or offensive language.
- **Hate Speech**: Detects speech that promotes hate or discrimination.
- **Political Bias**: Identifies politically biased or partisan content.
- **Adult Content**: Flags explicit or sexually suggestive content.
- **Secure**: Checks for content with potential security risks.
- **Phishing**: Identifies attempts to acquire sensitive information.
- **Personal Info**: Detects the presence of private personal data.

Support:
--------

[](#support)

Bug Tracker:

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity19

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/323a5cbb1087ce4edc9deec40b03736b6d43a3ca205615b346108ed57f58e50e?d=identicon)[naifdev](/maintainers/naifdev)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/naif-ai-validation/health.svg)

```
[![Health](https://phpackages.com/badges/naif-ai-validation/health.svg)](https://phpackages.com/packages/naif-ai-validation)
```

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

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