engaging-io / issue-reporter
A Laravel package for reporting GitHub issues using AI.
Requires
- php: ^7.3|^8.0|^8.1|^8.2|^8.3
- illuminate/http: ^8.0|^9.0|^10.0|^11.0|^12.17
- illuminate/support: ^8.0|^9.0|^10.0|^11.9|^12.17
This package is auto-updated.
Last update: 2025-06-10 14:01:17 UTC
README
A Laravel package for reporting exceptions to a designated endpoint with additional context, which can be used for automatic issue creation with AI assistance.
Features
- Report any exception with comprehensive context data
- Special handling for HTTP request exceptions (with additional request data)
- Integration with Slack notifications
- Connection to your GitHub repository for automated issue tracking
- Easy to configure and use in any Laravel application
Requirements
- PHP 7.3+
- Laravel 8.0+ / 9.0+ / 10.0+ / 11.0+ / 12.0+
Installation
You can install the package via Composer:
composer require engaging-io/issue-reporter
The package will automatically register its service provider if you're using Laravel 5.5+.
Configuration
Publish the configuration file:
php artisan vendor:publish --provider="EngagingIo\IssueReporter\IssueReporterServiceProvider"
This will create a config/issue-reporter.php
file where you can modify the package settings.
Environment Variables
Add these variables to your .env
file:
ISSUE_REPORTER_ENABLED=false # Set to true in production environments only
ISSUE_REPORTER_GITHUB_REFERENCE=main
ISSUE_REPORTER_GITHUB_REPOSITORY=your-repository
ISSUE_REPORTER_SLACK_WEBHOOK=https://hooks.slack.com/services/your/slack/webhook
Note: Always keep
ISSUE_REPORTER_ENABLED
set tofalse
for local development environments to prevent unnecessary reporting of development exceptions.
Usage
Basic Exception Reporting
use EngagingIo\IssueReporter\Facades\IssueReporter; try { // Your code that might throw an exception } catch (\Throwable $e) { IssueReporter::report($e); // Then handle the exception as you normally would }
In Exception Handlers
You can easily use the package in your Laravel exception handler:
// app/Exceptions/Handler.php namespace App\Exceptions; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use EngagingIo\IssueReporter\Facades\IssueReporter; use Throwable; class Handler extends ExceptionHandler { // ... public function report(Throwable $exception) { // You can add conditions to determine which exceptions to report if ($this->shouldReportToIssueReporter($exception)) { IssueReporter::report($exception); } parent::report($exception); } private function shouldReportToIssueReporter(Throwable $exception) { // Implement your logic to determine which exceptions to report return !$this->inExcludeList($exception) && app()->environment('production'); } // ... }
Using bootstrap/app.php (Laravel 10+)
For Laravel 10 and above, you can also integrate the issue reporter in your bootstrap/app.php
file:
// bootstrap/app.php use Illuminate\Foundation\Application; use Illuminate\Foundation\Configuration\Exceptions; use EngagingIo\IssueReporter\Facades\IssueReporter; // ... return Application::configure(basePath: dirname(__DIR__)) // ... ->withExceptions(function (Exceptions $exceptions) { // This section captures all types of exceptions. $exceptions->reportable(fn (\Throwable $e) => IssueReporter::report($e)); })->create();
HTTP RequestException Handling
The package automatically detects if the exception is an HTTP RequestException
and includes relevant request data in the report:
- Request headers
- Request body
- Response data (if available)
This additional information helps with debugging API-related issues.
Security
The package sends exception data to a designated endpoint. Make sure:
- Your Slack webhook URL is kept secure
- Your API endpoint is secured with proper authentication
- Sensitive data in error reports is properly sanitized
Configuration Options
Option | Environment Variable | Description |
---|---|---|
enabled |
ISSUE_REPORTER_ENABLED |
Whether the issue reporter is enabled (true/false). Should be set to false for local development |
reference |
ISSUE_REPORTER_GITHUB_REFERENCE |
The default branch or reference in your repository (e.g., 'main', 'master') |
repository |
ISSUE_REPORTER_GITHUB_REPOSITORY |
Your repository name in 'repo' format |
slack_webhook_url |
ISSUE_REPORTER_SLACK_WEBHOOK |
Your Slack webhook URL for notifications |
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Credits
License
The MIT License (MIT). Please see License File for more information.