PHP Classes

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

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-02-21 (7 months ago) RSS 2.0 feedNot enough user ratingsTotal: 49 All time: 10,717 This week: 74Up
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

Innovation Award
PHP Programming Innovation award nominee
February 2024
Number 4
Laravel is a well-known PHP framework used by many PHP developers who want to develop Web applications and APIs.

Laravel can be extended with packages that implement additional services that make Laravel more useful.

This package implements a validation service that uses ChatGPT API to validate form inputs of Web applications using specific prompts to check if the input values are of certain types.

This package makes it easy to validate form inputs that are usually hard to validate using traditional programming not based on artificial intelligence.

Manuel Lemos
Picture of Naif Alshaye
  Performance   Level  
Name: Naif Alshaye <contact>
Classes: 24 packages by
Country: Saudi Arabia Saudi Arabia
Age: ???
All time rank: 18576 in Saudi Arabia Saudi Arabia
Week rank: 216 Up2 in Saudi Arabia Saudi Arabia Up
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 (11)  
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 (11)  /  config  
File Role Description
  Accessible without login Plain text file ai-validation.php Aux. Auxiliary script

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

  Files folder image Files (11)  /  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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:49
This week:0
All time:10,717
This week:74Up