gamalkh299 / gpt-content-reviewer
A Laravel package to review content and images using ChatGPT API
Fund package maintenance!
Gamal Khaled
Requires
- php: ^8.2
- illuminate/contracts: ^10.0||^11.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.9
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^9.0.0||^8.22.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-arch: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
- phpstan/extension-installer: ^1.3
- phpstan/phpstan-deprecation-rules: ^1.1
- phpstan/phpstan-phpunit: ^1.3
- spatie/laravel-ray: ^1.35
This package is auto-updated.
Last update: 2025-06-16 17:36:26 UTC
README
This package allows you to review the content of a model using ChatGPT Moderation API.
Installation
You can install the package via composer:
composer require gamalkh299/gpt-content-reviewer
You can publish and run the migrations with:
php artisan vendor:publish --tag="gpt-content-reviewer"
php artisan migrate
This is the contents of the published config file:
return [ 'key' => env('CHAT_GPT_API_KEY'), 'queue' => env('GPT_QUEUE', 'gpt-content-reviewer'), ];
Usage
- At fisrt, you need to get an API key from ChatGPT.
- Then, you need to add the API key to your
.env
file.
CHAT_GPT_API_KEY=your-api-key
Then add the following trait to the model you want to review its content.
use gamalkh\GptContentReviewer\Traits\Reviewable;
Don't forget to implement the getReviewableColumns abstract function to specify the columns you want to review and handleReviewResult abstract function to handle the review result.
public function getReviewableColumns(): array { // return the columns you want to review return ['content']; } public function handleReviewResult($result) { // handle the review result }
before you use it you need to run the following command to create the review table.
php artisan queue:work --queue=gpt-content-reviewer
you can use the package to create a review for a model and it will be added to the queue to be reviewed.
$model = Model::find(1); $gptContentReviewer = new gamalkh\GptContentReviewer(); $gptContentReviewer->createReview($model);
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.