coedevtech/fixit
最新稳定版本:v1.9.0
Composer 安装命令:
composer require coedevtech/fixit
包简介
A Laravel package that captures and logs all exceptions into a database table — with optional encryption, email alerts, and a powerful CLI interface. Designed to give you full visibility into unhandled errors, without clutter or guesswork
README 文档
README
fixIt is a Laravel package that captures and logs all exceptions into a database table — with optional encryption, email or Slack alerts, and a powerful CLI interface. Designed to give you full visibility into unhandled errors, without clutter or guesswork.
🚀 Features
- ✅ Logs all unhandled exceptions to the database
- 🔐 Optional field-level encryption using Laravel Crypt
- 📧 Multi-recipient email alerts support
- ⚙️ Configurable notification system (email + Slack supported)
- 🧠 AI-powered fix suggestions (optional)
- 🌪️ Built-in Pest tests
- 📊 Artisan CLI:
fixit:reportto view, filter, and fix errors - ✍️
fixit:sync-configto merge missing config keys - 🛠️
fixit:sync-migrationsto publish and run package migrations - 🧪
fixit:verify-configto validate and auto-patch.env - 💡 Extensible alert interface (plug your own Discord, webhook, etc.)
🧩 Requirements
| Dependency | Version |
|---|---|
| PHP | ^8.1, ^8.2, or ^8.3 |
| Laravel | ^10.x, ^11.x, or ^12.x |
📦 Installation
composer require coedevtech/fixit
Then publish and install:
php artisan fixit:install
During installation, you’ll be prompted to enable encryption (optional). If enabled, a FIXIT_ENCRYPTION_KEY will be added to your .env file.
⚙️ Configuration
Publish the configuration file:
php artisan vendor:publish --tag=fixit-config
To check for missing config keys later, run:
php artisan fixit:sync-config
To verify and auto-patch missing .env keys:
php artisan fixit:verify-config php artisan fixit:verify-config --fix
To automatically append missing keys using short [] array syntax:
php artisan fixit:sync-config --write
For JSON output (CI pipelines):
php artisan fixit:verify-config --json
🔐 Manual Encryption / Decryption
fixIt provides two static methods via its facade to manually encrypt or decrypt data:
Encrypt data
use Fixit\Facades\Fixit; $encrypted = Fixit::encrypt(['email' => 'user@example.com']);
This encrypts any string or array using AES-256-CBC with a secure IV and stores it base64-encoded.
Decrypt data
$decrypted = Fixit::decrypt($encrypted);
This will return the original value (array or string), decrypted securely.
🗃️ Database Table
Includes fields like:
idurlrequestresponseipexceptionfilelinetracefingerprintoccurrenceslast_seen_atenvironmentstatus(not_fixed,fixed)created_at,updated_at
Table name is not configurable.
⚒️ Publishing Migrations
To publish and run any new package-provided migrations (e.g. adding new columns):
php artisan fixit:sync-migrations
This ensures that columns like fingerprint, last_seen_at, and occurrences are always present.
📧 Email Notifications
To receive an email when an error is logged:
- Set
send_on_errortotrue - Set the
notifications.emailin the config file - Ensure Laravel mail is properly configured
🧠 If you're using
QUEUE_CONNECTION=databaseorQUEUE_CONNECTION=redis, you must run:php artisan queue:workOtherwise, queued emails will not be sent and may block request execution depending on your queue setup.
Configure in .env:
FIXIT_SEND_EMAIL=true FIXIT_NOTIFICATION_EMAIL=admin@example.com,dev@example.com FIXIT_ALLOW_MULTIPLE_EMAILS=true
Emails will be sent to all valid addresses if
FIXIT_ALLOW_MULTIPLE_EMAILSis true.
🧠 AI Suggestions (Optional)
fixIt supports AI-powered suggestions for fixing logged errors. This is completely optional.
Enable AI-powered suggestions:
FIXIT_AI_ENABLED=true FIXIT_AI_API_KEY=sk-xxx # or use FIXIT_AI_API_URL FIXIT_AI_PROVIDER=openai # or fixit-proxy, groq, etc. FIXIT_AI_MODEL=gpt-3.5-turbo # or gpt-4 based on your provider FIXIT_AI_API_URL=https://www.proxy-url.com # Used for fixit-proxy
If enabled, suggestions are included in:
- 📧 Email alerts
- 💬 Slack alerts
- Future CLI/reporting support
🧪 Running Tests
./vendor/bin/pest
All tests are written using Pest and cover encryption, logging, config, and notifications.
🖥️ CLI Usage
View error logs:
php artisan fixit:report
Filter errors:
php artisan fixit:report --status=fixed php artisan fixit:report --all
Mark error as fixed:
php artisan fixit:report --fix=3
Sync and patch your config file:
php artisan fixit:sync-config # show missing keys php artisan fixit:sync-config --write # append missing keys to config/fixit.php
Publish and apply package migrations:
php artisan fixit:sync-migrations
🔌 Extending Alerts
You can bind your own alert channel by implementing the Fixit\Contracts\FixitAlertInterface.
Example for Slack, Discord, or webhook alerts:
use Fixit\Contracts\FixitAlertInterface; class SlackAlert implements FixitAlertInterface { public function send(string $message, ?Throwable $exception = null, ?string $suggestion = null): void { // Your logic here } }
Then bind it in a service provider:
app()->bind(FixitAlertInterface::class, SlackAlert::class);
🛡️ Security & Best Practices
- Uses Laravel’s encryption system
- Avoids session or user tracking by default
- Decoupled and test-driven design
- Ready to extend with custom drivers or UI layers
📝 Changelog
See Releases for full changelog.
统计信息
- 总下载量: 181
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-13