Download the PHP package tetra7/laravel-error-issue-creator without Composer
On this page you can find all versions of the php package tetra7/laravel-error-issue-creator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tetra7/laravel-error-issue-creator
More information about tetra7/laravel-error-issue-creator
Files in tetra7/laravel-error-issue-creator
Package laravel-error-issue-creator
Short Description Automatically creates or updates a GitHub issue for every HTTP 500 error in production.
License MIT
Informations about the package laravel-error-issue-creator
Laravel Error Issue Creator
A Laravel package by Tetra 7 that automatically opens a GitHub issue whenever an HTTP 500 error occurs in production, then prevents duplicate issues by tracking occurrences and updating the same issue.
Features
- Auto-discovery: ServiceProvider is registered automatically by Laravel.
- HTTP 500 interception: Hooks into the exception handler to catch server errors.
- GitHub integration: Uses the GitHub API to create issues or add comments.
- Deduplication: Only one issue per unique error; subsequent occurrences post comments with a counter.
- Configurable: Customize token, repository, labels, cache TTL via published configuration.
Requirements
- PHP ^7.4 or ^8.0
- Laravel ^8.0, ^9.0, ^10.0, ^11.0 or ^12.0
- A GitHub Personal Access Token with issues: read & write permission
Installation
Install via Composer:
Once your package is published on Packagist under
tetra7/laravel-error-issue-creator, you can remove any local path repository entries in yourcomposer.json.
Configuration
Publish the configuration file:
Edit config/error-issue-creator.php as needed:
Add the following to your .env:
Usage
-
Production mode (
APP_ENV=production): Any HTTP 500 error triggers the package. -
First occurrence: Opens a new GitHub issue titled
with the configured labels.
- Subsequent occurrences within the cache TTL: Adds a comment on the existing issue, updating the occurrence count.
Testing in Development
Define a test route that throws a consistent exception:
Hit /test-error-dup multiple times (within the TTL). You should see:
- First request: one issue created.
- Next requests: comments appended to that same issue, with increasing counters.
Advanced Customization
- Labels: controlled by the
GITHUB_LABELSenv variable. - Cache duration: override
ERROR_ISSUE_CACHE_TTL(in seconds). - Error filter: modify
ErrorIssueServiceProviderto catch other exception types or additional HTTP status codes by adding amonitor_statusesconfig option.
Troubleshooting
-
No issues created:
- Verify
APP_ENV=production. - Confirm your Personal Access Token has issues: read & write scopes.
- Make sure you’ve published and edited the package config.
- Verify
-
Multiple issues for the same error:
- Ensure the exception message, file, and line remain identical on each occurrence.
- Check your
cache_ttlhasn’t expired between requests.
-
No 404/403 logging (if you’ve added those statuses):
- Laravel by default doesn’t report HTTP exceptions. Either remove
HttpExceptionInterfacefrom your app’s$dontReport, or switch your package’s callback fromreportable()torenderable()so it fires for 404s.
- Laravel by default doesn’t report HTTP exceptions. Either remove
-
Queue issues:
- By default, the package uses
QUEUE_CONNECTION=sync. - For asynchronous processing, set
QUEUE_CONNECTION=databaseorredisand run a worker:
- By default, the package uses
Contributing
Pull requests welcome! Please adhere to PSR-12 coding standards, write tests for new features, and update this README if you change any behavior.
License
This package is open-sourced under the MIT License.