Building tools for
Fair job distribution with per-user concurrency limits. Round-robin, random, and smart strategies.
Static analyzer for Laravel queue job configurations. Catches misconfigurations before they cause duplicate execution or silent failures.
Standalone daemon that monitors PHP workers from the outside via /proc. Catches OOM kills with full job context — no code changes required.
Interactive PHP REPL for Laravel. Desktop app + PhpStorm plugin. SSH & Docker, magic comments, Claude AI integration.
A Laravel package for queue management with load balancing between partitions (user groups). Perfect for scenarios where you need fair job distribution and concurrency control per user/tenant.
composer require yangusik/balanced-queue
php artisan vendor:publish --tag="balanced-queue-config"
return [
'connection' => env('BALANCED_QUEUE_CONNECTION', 'redis'),
// Strategy: 'round-robin' | 'random' | 'smart'
'strategy' => 'round-robin',
// Max concurrent jobs per partition
'limiter' => [
'driver' => 'simple', // 'simple' | 'adaptive' | 'none'
'max_concurrent' => 2,
],
'queue' => env('BALANCED_QUEUE_NAME', 'default'),
];
use YanGusik\BalancedQueue\Traits\HasBalancedQueue;
class ProcessReport implements ShouldQueue
{
use HasBalancedQueue;
public function __construct(
private User $user,
private Report $report,
) {}
// Partition key — one partition per user
public function partitionKey(): string
{
return 'user:' . $this->user->id;
}
}
// Dispatch normally — balancing is automatic
ProcessReport::dispatch($user, $report);
php artisan balanced-queue:table # Show live stats
php artisan balanced-queue:clear # Clear all partitions
Cycles through partitions in order. Guaranteed fairness — every user gets equal turns regardless of queue size.
strategy: 'round-robin'
Prioritizes partitions with fewer jobs. Helps clear smaller queues faster but may not be perfectly fair.
strategy: 'smart'
Randomly selects the next partition. Simple, low overhead, statistically fair over time.
strategy: 'random'
Static analyzer for Laravel queue job configurations. Catches misconfigurations before they cause duplicate execution, memory leaks, or silent failures — zero invasiveness, no changes to your jobs required.
composer require yangusik/laravel-queue-inspector
php artisan queue:analyze # text output
php artisan queue:analyze -v # verbose: show value sources
php artisan queue:analyze --format=json # JSON for piping
vendor/bin/queue-inspector --path=/var/www --strict
vendor/bin/queue-inspector --strict --path=/var/www/html
- name: Analyze queue jobs
run: vendor/bin/queue-inspector --strict --format=json | jq .
php artisan queue:analyze \
--exclude-ns="App\Notifications" \
--exclude-ns="App\Mail"
/**
* @deprecated
* @queue-inspector-ignore
*/
class LegacyJob implements ShouldQueue {}
#[QueueInspectorIgnore]
class AnotherJob implements ShouldQueue {}
// --exclude-ns flag skips entire namespace:
// php artisan queue:analyze --exclude-ns="App\Notifications"
@deprecated or @queue-inspector-ignore — PHPDoc annotation#[QueueInspectorIgnore] — PHP 8+ attribute#[Deprecated] — JetBrains PhpStorm / native PHP 8.4--exclude-ns=App\Notifications — skip entire namespace via CLIA standalone Go daemon that monitors PHP worker processes from the outside via /proc. No code changes required. Catches OOM kills and memory leaks with full context about which job and payload was running.
git clone https://github.com/yangusik/php-watchdog
cd php-watchdog
go build -o watchdog ./cmd/watchdog/
go build -o rss-check ./cmd/rss-check/
cp watchdog /usr/local/bin/watchdog
systemctl enable watchdog
systemctl start watchdog
/proc/PID/status from outside the processmemory_get_usage()interval: 5 # seconds between RSS snapshots
ring_buffer: 60 # snapshots kept per process
socket: /var/run/watchdog.sock # optional framework socket
watchers:
- name: "queue-workers"
mask: "queue:work"
thresholds:
rss_absolute_mb: 500
growth_snapshots: 10
pool_rss_total_mb: 4096
pool_kill_strategy: "heaviest"
on_anomaly:
kill: true
dump_path: /var/log/watchdog/
webhook: "" # optional HTTP POST
exec: "" # optional shell script
rss_absolute_mbgrowth_snapshots consecutive snapshotspool_rss_total_mb./rss-check --filter=queue:work
./rss-check --filter=horizon
services:
horizon:
image: your-app-image
command: php artisan horizon
volumes:
- watchdog-socket:/var/run/watchdog
watchdog:
image: yangusik/php-watchdog:latest
volumes:
- /proc:/proc:ro
- ./watchdog.yml:/etc/watchdog/watchdog.yml:ro
- watchdog-socket:/var/run/watchdog
- watchdog-reports:/var/log/watchdog
restart: unless-stopped
volumes:
watchdog-socket:
watchdog-reports:
Interactive PHP REPL for Laravel. Run code on remote servers via SSH or Docker — right from your desktop or inside PhpStorm.
//? after any expression to see its value inline — no var_dump() needed.// Capture line value
$users = User::find(36)->id; //? → ← 36
// Capture mid-chain (passes original through)
collect([1,2,3])/*?*/->count()/*?*/->map(fn($x) => $x * 2);
// ← [1,2,3] ← 3
// Timing (ms since script start)
heavyOperation(); /*?.*/ → ← 142ms