Download the PHP package imtigger/laravel-job-status without Composer
On this page you can find all versions of the php package imtigger/laravel-job-status. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-job-status
Laravel Job Status
Laravel package to add ability to track Job
progress, status and result dispatched to Queue
.
- Queue name, attempts, status and created/updated/started/finished timestamp.
- Progress update, with arbitrary current/max value and percentage auto calculated
- Handles failed job with exception message
- Custom input/output
- Native Eloquent model
JobStatus
-
Support all drivers included in Laravel (null/sync/database/beanstalkd/redis/sqs)
-
This package intentionally do not provide any UI for displaying Job progress.
If you have such need, please refer to laravel-job-status-progress-view
or make your own implementation using
JobStatus
model
Requirements
- PHP >= 7.1
- Laravel/Lumen >= 5.5
Installation
Installation for Laravel
Installation for Lumen
Usage
In your Job
, use Trackable
trait and call $this->prepareStatus()
in constructor.
In your Job dispatcher, call $job->getJobStatusId()
to get $jobStatusId
:
$jobStatusId
can be used elsewhere to retrieve job status, progress and output.
Troubleshooting
Call to undefined method ...->getJobStatusId()
Laravel provide many ways to dispatch Jobs. Not all methods return your Job object, for example:
If you really need to dispatch job in this way, workarounds needed: Create your own key
-
Create migration adding extra key to job_statuses table.
-
In your job, generate your own unique key and pass into
prepareStatus();
,$this->prepareStatus(['key' => $params['key']]);
- Find JobStatus another way:
$jobStatus = JobStatus::whereKey($key)->firstOrFail();
Status not updating until transaction commited
On version >= 1.1, dedicated database connection support is added.
Therefore JobStatus updates can be saved instantly even within your application transaction.
Read setup step 6 for instructions.
Documentations
Note
$jobStatus->job_id
result varys with driver
Driver | job_id |
---|---|
null | NULL (Job not run at all!) |
sync | empty string |
database | integer |
beanstalkd | integer |
redis | string(32) |
sqs | GUID |
All versions of laravel-job-status with dependencies
illuminate/contracts Version >=5.5
illuminate/database Version >=5.5
illuminate/queue Version >=5.5
illuminate/support Version >=5.5
nesbot/carbon Version >=1.21
ext-json Version *