rakibhossainporosh / laravel-codepulse
AI-Powered Code & Security Review Engine for Laravel using Google Gemini BYOK
Package info
github.com/rakibhossainporosh/laravel-codepulse
pkg:composer/rakibhossainporosh/laravel-codepulse
Requires
- php: ^8.2|^8.3|^8.4
- illuminate/support: ^11.0|^12.0|^13.0
Requires (Dev)
- orchestra/testbench: ^9.0|^10.0
- phpunit/phpunit: ^10.5|^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
CodePulse AI is an automated code quality, security vulnerability, and performance auditing package for Laravel applications powered by Google Gemini BYOK (Bring Your Own Key).
Key Highlights
- Terminal Audit Command: Scan files, controllers, or staged Git changes right from your terminal with
php artisan codepulse:check --staged. - Automated Git Pre-Commit Hook: Install a Git pre-commit quality gate with
php artisan codepulse:hook --installto prevent critical vulnerabilities from ever being committed. - Drop-in Web Dashboard: Interactive, zero-dependency dashboard accessible at
/codepulsewith dark/light themes, drag-and-drop file upload, and real-time status polling. - Line-by-Line Code Inspector: View line-highlighted syntax, detailed vulnerability findings, and 1-click "Copy Fix" buttons.
- Markdown Export: Copy or download detailed audit reports in standard Markdown (.md) format.
- BYOK Architecture: Zero monthly fees; runs directly on your Google Gemini quota.
- Automatic Model Fallback: Automatically falls back from
gemini-3.8-flashtogemini-3.5-flash-liteon rate limits (HTTP 429) or service outages (HTTP 503). - CI/CD Ready: Returns exit code 1 when critical security issues or severe bottlenecks are detected.
Installation
Install the package via Composer:
composer require rakibhossainporosh/laravel-codepulse --dev
Run the interactive install command:
php artisan codepulse:install
This will publish config/codepulse.php and run the required database migrations.
Configuration
Obtain a Gemini API key from Google AI Studio and add it to your .env file:
CODEPULSE_GEMINI_KEY=AQ.your_gemini_api_key_here CODEPULSE_PATH=codepulse CODEPULSE_DEFAULT_MODEL=gemini-3.8-flash
Usage
1. Terminal Code Auditing
Audit staged Git changes before committing:
php artisan codepulse:check --staged
Audit a specific controller or directory:
php artisan codepulse:check app/Http/Controllers/OrderController.php
2. Git Pre-Commit Quality Gate
Automatically audit staged files before every git commit:
# Install Git pre-commit hook php artisan codepulse:hook --install # Remove Git pre-commit hook php artisan codepulse:hook --remove
3. Web Dashboard
Navigate to /codepulse in your browser.
In local and testing environments, the dashboard is open automatically. In production, protect access via Gate::define('viewCodePulse', ...) in your AppServiceProvider.
4. Programmatic Inspection via Facade
use CodePulse\Facades\CodePulse; $result = CodePulse::review($sourceCode, language: 'PHP'); $scores = $result['scores']; $findings = $result['findings'];
Testing
vendor/bin/phpunit
License
This package is open-sourced software licensed under the MIT license.