Download the PHP package refactorlab/ai-code-reviewer without Composer
On this page you can find all versions of the php package refactorlab/ai-code-reviewer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download refactorlab/ai-code-reviewer
More information about refactorlab/ai-code-reviewer
Files in refactorlab/ai-code-reviewer
Package ai-code-reviewer
Short Description AI-powered code review tool for Laravel, integrated with GitHub and OpenAI.
License MIT
Informations about the package ai-code-reviewer
AI Code Reviewer v1.0.0
Introduction
AI Code Reviewer is a powerful Laravel package that automatically analyzes GitHub pull requests using OpenAI's GPT-4. It helps improve code quality by identifying potential issues, bugs, and suggesting improvements - all without manual intervention.
The package listens for GitHub webhook events when pull requests are opened or updated, extracts the code changes, sends them to OpenAI for analysis, and then posts the AI-generated review comments directly back to the pull request on GitHub.
This intelligent code review assistant saves developer time, helps maintain coding standards, and can catch issues that might be missed during human review.
Features
- 🤖 Listens to GitHub pull request webhooks
- 🔍 Sends code diffs to OpenAI for analysis
- 💬 Posts AI-generated review comments back to the pull request
- ⚙️ Configurable file filters and settings
- 🔒 Secure webhook handling with signature verification
- 🔄 Batch processing for large pull requests
- 🧠 Customizable AI prompts and response handling
- 🛠️ Extensive configuration options
Installation
You can install the package via composer:
The package will automatically register its service provider with Laravel's auto-discovery.
Configuration
Publish the configuration file:
This will create a config/aicode.php
file where you can configure the package.
Required Environment Variables
Add the following to your .env
file:
OPENAI_API_KEY
: Your OpenAI API key (requires access to GPT-4)GITHUB_API_TOKEN
: A GitHub personal access token withrepo
scopeGITHUB_WEBHOOK_SECRET
: A secret string to verify webhook requests
Detailed Configuration
The config/aicode.php
file contains the following sections:
OpenAI Configuration
model
: The OpenAI model to use (default: gpt-4-turbo)temperature
: Controls randomness (0-1, lower = more deterministic)max_tokens
: Maximum token limit for responses
GitHub Configuration
File Filters
Review Settings
Usage
Setting up the GitHub Webhook
- Go to your GitHub repository's settings
- Click on "Webhooks" → "Add webhook"
-
Set the Payload URL to:
- Select content type:
application/json
- Enter your webhook secret (same as
GITHUB_WEBHOOK_SECRET
) - Under "Which events would you like to trigger this webhook?", select "Pull requests"
- Ensure "Active" is checked and click "Add webhook"
Once set up, the AI Code Reviewer will automatically analyze new pull requests and post its review as comments.
Example GitHub PR Comments
When the AI Code Reviewer analyzes a pull request, it will post comments like these:
Example 1: Bug Detection
Example 2: Code Improvement
Example 3: Security Issue
Testing
Security
If you discover any security issues, please contact the author directly instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.
Changelog
Please see CHANGELOG for more information on what has changed recently.
All versions of ai-code-reviewer with dependencies
illuminate/support Version ^11.0
illuminate/http Version ^11.0
illuminate/routing Version ^11.0
guzzlehttp/guzzle Version ^7.8
openai-php/client Version ^0.8.0