softgala/laravel-claude-button
最新稳定版本:v1.1.0
Composer 安装命令:
composer require softgala/laravel-claude-button
包简介
Adds an error copy button to Laravel 500 pages. Clipboard + VS Code integration for AI-assisted debugging.
关键字:
README 文档
README
A Laravel package that adds a one-click button to your error pages. Instantly copy error details to your clipboard and optionally open the file in VS Code. Perfect for AI-assisted debugging with ChatGPT, Claude, Copilot, or any AI assistant.
Features
- 🚀 One-Click Error Copying: Instantly copy error details to clipboard - ready to paste into any AI chat
- 📋 Smart Clipboard: Works in HTTP contexts without HTTPS (perfect for local development)
- 🔗 Optional VS Code Integration: Toggle to automatically open error file in VS Code
- 💾 File Export: Saves error details to
storage/app/claude-errors/latest-error.mdfor easy reference - 🎨 Clean UI: Beautiful, non-intrusive button that appears only on errors
- 🎛️ Settings Card: Toggle VS Code auto-open on/off (preference saved in browser)
- 🔒 Environment-Safe: Only shows in local/development environments
- 🤖 AI-Ready Format: Clean error message + file location - perfect for any AI assistant
- ⚙️ Zero Config: Works immediately after installation
Installation
Install the package via Composer:
composer require softgala/laravel-ai-debug-copy
The package will automatically register its service provider.
Configuration
Publish the configuration file (optional):
php artisan vendor:publish --tag=claude-button-config
This will create a config/claude-button.php file where you can customize:
return [ // Enable or disable the button 'enabled' => env('AI_DEBUG_BUTTON_ENABLED', true), // Only show in these environments 'environments' => ['local', 'development'], // Stack trace depth (0 = cleanest, just error + location) // Set to 3+ to include stack trace for deeper debugging 'trace_depth' => 0, ];
Note on trace_depth:
0(default): Shows only error message and file location - cleanest format for AI3+: Includes stack trace frames for additional context
Usage
Once installed, the package will automatically add a "Copy Error for AI" button to any 500 error pages in your allowed environments.
Testing
Visit the test route to see it in action:
http://your-app.test/error/test
How it Works
- When an error occurs, a settings card and button appear in the bottom-right corner
- Settings Card: Toggle "Open VS Code" on/off (preference saved in browser)
- Click the button to:
- Copy error details to clipboard (works in HTTP and HTTPS)
- Save error report to
storage/app/claude-errors/latest-error.md - Open VS Code at the exact line where the error occurred (if enabled)
- Paste into your AI assistant:
- Open ChatGPT, Claude, Copilot, or any AI chat
- Paste (Cmd+V / Ctrl+V) - error details already in clipboard
- Or open
storage/app/claude-errors/latest-error.mdand share the file
- Get instant AI-assisted debugging and solutions!
What Gets Copied
The button formats error information cleanly and concisely:
Test error message here
/path/to/file.php:123
That's it! Just the error message and file location. This clean format works perfectly with any AI assistant:
- ChatGPT, Claude, Copilot, or any AI tool
- Paste and get instant analysis
- AI understands the file path and line number
- No verbose formatting - straight to the point
Security
- The button only appears in local/development environments
- No data is sent to external servers
- All processing happens client-side
- VS Code opens via local
vscode://protocol
Requirements
- PHP 8.1 or higher
- Laravel 10.x, 11.x, or 12.x
- VS Code (optional, for auto-opening error files)
Publishing Views
To customize the button appearance, publish the views:
php artisan vendor:publish --tag=claude-button-views
This will create resources/views/vendor/claude-button/button.blade.php.
Error Files
The package automatically saves error details to:
storage/app/claude-errors/latest-error.md- Always contains the most recent errorstorage/app/claude-errors/latest-error-YYYY-MM-DD-HHMMSS.md- Timestamped backups
Old error files are automatically cleaned (keeps last 10).
Example error file:
Test error for AI debug button - This is a demo error! /path/to/file.php:123 --- *Error captured at: 2025-10-12 14:30:45* *Type: Exception*
These markdown files can be:
- Opened directly in VS Code
- Shared with any AI assistant via file upload or copy/paste
- Committed to your repo for team debugging
- Used for error documentation
Tips for Best Results
-
With Any AI Assistant:
- Click button, paste error into ChatGPT/Claude/Copilot/etc
- Error is already formatted and ready to go
- Get instant analysis and solutions
-
VS Code Toggle:
- Toggle "Open VS Code" OFF if you prefer clipboard only
- Your preference is saved in browser localStorage
- Perfect for quick copy without opening editor
-
Non-HTTPS Development:
- Works perfectly on
http://localhostor any HTTP context - Smart clipboard fallback ensures it always works
- No SSL certificate required
- Works perfectly on
-
Team Debugging:
- Share the
latest-error.mdfile with teammates - Everyone can paste the same error into their preferred AI tool
- Consistent error format across team
- Share the
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
Security
If you discover any security-related issues, please email contact@softgala.com instead of using the issue tracker.
Changelog
Please see CHANGELOG.md for recent changes.
License
MIT-0 (MIT No Attribution). Use it however you want, no attribution required. Please see LICENSE for more information.
Credits
Support
- Issues: GitHub Issues
- Email: contact@softgala.com
- Website: softgala.com
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT-0
- 更新时间: 2025-10-11
