lucifer07 / phpuan-jck
There is no license information available for the latest version (v1.0.0) of this package.
A Laravel Performance Profiler Library for local development with Xdebug integration
v1.0.0
2026-01-16 20:56 UTC
Requires
- php: ^8.0
- laravel/framework: ^9.0|^10.0|^11.0
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