PHP Classes

ChatGPT Laravel Validation for Form Inputs: Validate form inputs using artificial intelligence

Recommend this page to a friend!
  Info   View files Documentation   View files View files (11)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-02-21 (2 days ago) RSS 2.0 feedNot enough user ratingsTotal: 21 This week: 21All time: 11,130 This week: 3Up
Version License PHP version Categories
ai-validation 1.0.0MIT/X Consortium ...5PHP 5, Libraries, Validation, Artific...
Description 

Author

This package can validate form inputs using artificial intelligence.

It uses ChatGPT API to send requests using prompts to check if given form input values are of certain types.

Currently, this package uses ChatGPT prompts to check if an input value can be:

- Spam

- Non-sense text

- Text generated by bots

- Excessive use of emojis

- Advertisement

- Hate speech

- Politically biased speech

- SQL inject or Cross-site scripting security attacks

- Phishing attacks

- Personal information

Picture of Naif Alshaye
  Performance   Level  
Name: Naif Alshaye <contact>
Classes: 24 packages by
Country: Saudi Arabia Saudi Arabia
Innovation award
Innovation award
Nominee: 9x

Documentation

AI Validation

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

Requirements

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

Installation

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

composer require naif/ai-validation

Publish config file

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

OpenAI API Key

Create your API Key from https://platform.openai.com/api-keys

Add API Key in .env file

CHATGPT_API_KEY=

Usage

Field validation rule

use Naif\AIValidation\Rules\AIValidation;

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

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:

naif@naif.io

https://naif.io

Bug Tracker:

https://github.com/naifalshaye/ai-validation/issues/new

License

The MIT License (MIT). Please see License File for more information.


  Files folder image Files  
File Role Description
Files folder imageconfig (1 file)
Files folder imagesrc (1 file, 1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  config  
File Role Description
  Accessible without login Plain text file ai-validation.php Aux. Auxiliary script

  Files folder image Files  /  src  
File Role Description
Files folder imageRules (6 files)
  Plain text file AIValidationServiceProvider.php Class Class source

  Files folder image Files  /  src  /  Rules  
File Role Description
  Plain text file AbstractAIValidationRule.php Class Class source
  Plain text file AIValidation.php Class Class source
  Plain text file AIValidationRule.php Class Class source
  Plain text file AIValidationRuleLaravel10.php Class Class source
  Plain text file AIValidationRuleLaravel8.php Class Class source
  Plain text file AIValidationRuleLaravel9.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:21
This week:21
All time:11,130
This week:3Up