lucifer07/phpuan-jck
Composer 安装命令:
composer require lucifer07/phpuan-jck
包简介
A Laravel Performance Profiler Library for local development with Xdebug integration
README 文档
README
using Xdebug traces to detect memory leaks and slow execution paths.
Features
- 📊 Dashboard with performance statistics
- 🔍 Trace browser and detailed view
- ⚠️ Automatic problem detection (slow functions, memory hogs, high frequency calls)
- 📈 Hotspot identification
- 💾 Memory usage tracking
- 🚀 Zero overhead when disabled
Installation
Quick Install (Recommended)
composer require phpuan-jck/phpuan-jck php artisan phpuan-jck:install
That's it! The installer will:
- Publish configuration file
- Publish migrations
- Run migrations
- Register middleware automatically
Manual Install
If you prefer manual installation:
# 1. Install package composer require lucifer07/phpuan-jck # 2. Publish configuration php artisan vendor:publish --provider="PhpuanJck\Providers\PhpuanJckServiceProvider" --tag="phpuan-jck-config" # 3. Publish and run migrations php artisan vendor:publish --provider="PhpuanJck\Providers\PhpuanJckServiceProvider" --tag="phpuan-jck-migrations" php artisan migrate # 4. Register middleware (bootstrap/app.php for Laravel 10+) $middleware->append(\PhpuanJck\Middleware\ProfilerMiddleware::class);
Configuration
Xdebug (Required)
Xdebug must be installed and configured:
[xdebug] xdebug.mode=profile,trace xdebug.start_with_request=no xdebug.trace_format=1 xdebug.trace_output_dir=/tmp
Restart PHP-FPM or Valet after configuration.
Optional Config
Edit config/phpuan-jck.php:
return [ 'enabled' => env('PHPUAN_JCK_ENABLED', true), 'slow_threshold_ms' => 100, // Default threshold for slow functions 'memory_threshold_bytes' => 1048576, // 1MB 'ignore_namespaces' => [ 'Illuminate\\', 'Composer\\', 'Symfony\\', 'Carbon\\', ], 'ignore_paths' => [ '/vendor/', '/storage/framework/', ], ];
Usage
Profile a Request
Add ?__profile=true to any URL:
curl http://your-app.test/api/users?__profile=true
Or visit in browser:
http://your-app.test/api/users?__profile=true
Access Dashboard
Visit http://your-app.test/phpuan-jck to access the profiler dashboard.
Available Routes:
/phpuan-jck- Main Dashboard/phpuan-jck/traces- Browse all traces/phpuan-jck/detail/{id}- View trace details/phpuan-jck/problems- View detected problems/phpuan-jck/call-path- Call path analysis/phpuan-jck/telescope- Telescope-style overview
Problem Detection
PhpuanJck automatically detects:
- Slow Functions - Functions taking more than 2x threshold (default: 200ms)
- Memory Hogs - Functions using more than 1MB of memory
- High Frequency Calls - Functions called more than 20 times
- Nested Loops - Potential O(n²) complexity issues
Commands
# Install PhpuanJck php artisan phpuan-jck:install # Cleanup old traces php artisan phpuan-jck:cleanup # Cleanup with dry-run php artisan phpuan-jck:cleanup --dry-run
Performance
- Zero overhead when profiling is disabled
- Minimal overhead (~5-10%) when profiling is enabled
- Uses Xdebug traces for accurate call stack attribution
- Stores only trace metadata in database, trace files stored separately
Security
⚠️ Important: PhpuanJck is designed for local development only.
Disable in production:
# In .env
PHPUAN_JCK_ENABLED=false
Or restrict to local environment:
// In config/phpuan-jck.php 'enabled' => env('APP_ENV') === 'local',
Development
Run tests
vendor/bin/pest
Clear cache
php artisan cache:clear php artisan config:clear php artisan view:clear
Troubleshooting
"Xdebug not found" error
Ensure Xdebug is installed and configured in your php.ini.
Traces not appearing
- Check
config/phpuan-jck.phphas'enabled' => true - Ensure middleware is registered
- Verify database migrations ran successfully
- Check storage permissions for trace files
Dashboard shows 404
- Clear routes cache:
php artisan route:clear - Clear config cache:
php artisan config:clear - Verify ServiceProvider is registered
License
MIT License
lucifer07/phpuan-jck 适用场景与选型建议
lucifer07/phpuan-jck 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 lucifer07/phpuan-jck 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lucifer07/phpuan-jck 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 33
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2026-02-04