1. Go to this page and download the library: Download storviaio/vantage library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
storviaio / vantage example snippets
use Storvia\Vantage\Facades\Vantage;
// Get queue depth for all queues
$depths = Vantage::queueDepth();
// Get failed jobs
$failedJobs = Vantage::failedJobs(limit: 100);
// Get jobs by tag
$emailJobs = Vantage::jobsByTag('email', limit: 50);
// Get statistics
$stats = Vantage::statistics(startDate: now()->subDays(7));
// Returns: ['total' => 1000, 'processed' => 950, 'failed' => 50, 'processing' => 0, 'success_rate' => 95.0]
// Retry a failed job programmatically
Vantage::retryJob($jobId);
// Clean up stuck jobs older than 24 hours
$cleaned = Vantage::cleanupStuckJobs(hoursOld: 24);
// Prune old jobs
$deleted = Vantage::pruneOldJobs(daysOld: 30);
// Check if Vantage is enabled
if (Vantage::enabled()) {
// Monitor critical jobs
}
use Illuminate\Support\Facades\Gate;
public function boot(): void
{
Gate::define('viewVantage', function ($user = null) {
// Only allow admins
return optional($user)->isAdmin();
// Or any other custom logic
// return $user && $user->hasRole('developer');
});
}
use Storvia\Vantage\Contracts\ShouldNotBeTracked;
class MyNoisyJob implements ShouldQueue, ShouldNotBeTracked
{
public function handle(): void { ... }
}
use Storvia\Vantage\Models\VantageJob;
// Create test jobs
$job = VantageJob::factory()->create();
// Create specific job states
$failedJob = VantageJob::factory()->failed()->create();
$processingJob = VantageJob::factory()->processing()->create();
$processedJob = VantageJob::factory()->processed()->create();
// Create jobs with tags
$taggedJob = VantageJob::factory()
->withTags(['email', 'notification'])
->create();
// Create jobs on specific queues
$highPriorityJob = VantageJob::factory()
->onQueue('high')
->create();
// Create a retry chain
$originalJob = VantageJob::factory()->failed()->create();
$retryJob = VantageJob::factory()
->retriedFrom($originalJob->id)
->create();
// Create jobs with specific class names
$emailJob = VantageJob::factory()
->jobClass('App\\Jobs\\SendEmailJob')
->create();
protected function schedule(Schedule $schedule)
{
// Prune jobs older than retention_days config (uses VANTAGE_RETENTION_DAYS or default: 14 days)
// --force skips confirmation prompt (