JobPayload
A queued job identified by class + constructor params, not a serialized object — on execution the class is rebuilt via Container::make(), so constructor-injected services autowire normally.
$params must be JSON-serializable for persistent drivers (e.g. quioteframework/queue-db); the in-process sync driver has no such restriction.
$jobClass is deliberately typed as plain string, not class-string<Job>: a persistent driver builds this DTO from stored data (e.g. a DB row) that hasn’t been validated yet — the guarantee is established at the point of use instead (JobExecutor::attempt()’s instanceof Job check), not at construction.
Synopsis
Section titled “Synopsis”final readonly class JobPayload
| Source | JobPayload.php |
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
$attempts | int | readonly. |
$availableAt | ?DateTimeImmutable | readonly. |
$jobClass | string | readonly. |
$params | array | readonly. |
Constructor
Section titled “Constructor”__construct()
Section titled “__construct()”public function __construct(string $jobClass, array<string, mixed> $params = [], int $attempts = 0, ?DateTimeImmutable $availableAt = null): mixed
| Parameter | Type | Description |
|---|---|---|
$jobClass | string | |
$params | array``<``string``, ``mixed``> | |
$attempts | int | |
$availableAt | ?DateTimeImmutable |
Returns mixed
Methods
Section titled “Methods”| Method | Description |
|---|---|
withAttempts(int $attempts): JobPayload | Returns a copy with the attempt counter replaced. |
withAttempts()
Section titled “withAttempts()”public function withAttempts(int $attempts): JobPayload
Returns a copy with the attempt counter replaced.
Job class, params and availability time are carried over unchanged; the receiver is not modified.
| Parameter | Type | Description |
|---|---|---|
$attempts | int |
Returns JobPayload