ai-os/error-agent
Composer 安装命令:
composer require ai-os/error-agent
包简介
AI Engineering OS — PHP error capture & auto-fix agent for Laravel and any PHP project.
README 文档
README
Capture PHP errors and send them to AI Engineering OS for centralized tracking and auto-fix.
Installation
composer require ai-os/error-agent
Laravel
1. Add to .env
AI_OS_API_URL=http://your-platform:3001 AI_OS_PROJECT_ID=your-project-uuid
2. Register Service Provider (auto-discovered by Laravel)
3. Publish config (optional)
php artisan vendor:publish --tag=error-agent-config
4. Override Exception Handler
In app/Exceptions/Handler.php:
use AiOs\ErrorAgent\ErrorAgent; public function register(): void { $this->reportable(function (Throwable $e) { ErrorAgent::capture($e, config('error-agent')); return false; }); }
Usage (any PHP)
use AiOs\ErrorAgent\ErrorAgent; $agent = new ErrorAgent([ 'apiUrl' => 'http://localhost:3001', 'projectId' => 'your-uuid', ]); try { // your code } catch (\Throwable $e) { $agent->send([ 'message' => $e->getMessage(), 'severity' => 'critical', 'stack' => $e->getTraceAsString(), 'projectType' => 'laravel', 'source' => 'agent', 'context' => [ 'file' => $e->getFile(), 'line' => $e->getLine(), ], ]); throw $e; } // Or static method ErrorAgent::capture($e, [ 'apiUrl' => 'http://localhost:3001', 'projectId' => 'your-uuid', ]);
Endpoint
POST /api/projects/:projectId/errors/log Content-Type: application/json { "message": "Error message", "severity": "critical", "stack": "#0 /var/www/...", "projectType": "laravel", "source": "agent", "context": { "file": "UserController.php", "line": 42 } }
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-12