The #[FlareJob] attribute
Zeridion\Flare\Worker\FlareJob is a PHP 8 attribute that configures a job
class. Apply it to any Job or RecurringJob
implementation.
use Zeridion\Flare\Worker\FlareJob;
#[FlareJob(
name: 'SendWelcomeEmail',
queue: 'email',
maxAttempts: 5,
timeoutSeconds: 60,
)]
final class SendWelcomeEmail implements Job { /* ... */ }
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
name | string | '' | The wire job type. When empty, the fully-qualified class name is used. |
queue | string | 'default' | Queue this job runs on. |
maxAttempts | int | 3 | Maximum attempts before the server dead-letters the job. |
timeoutSeconds | int | 1800 | Per-attempt timeout. Also drives the heartbeat cadence. |
cron | string | '' | Cron expression (recurring jobs only). |
timezone | string | '' | Timezone for the cron expression (recurring jobs only). |
payloadClass | ?string | null | Hydrate the payload into this class instead of an array. |
The name (wire job type)
The name is the routing key the server uses to match a job to a handler.
Set it explicitly when the same job type might be enqueued from another
language or service — a shared queue needs everyone to agree on one string. If
you omit name, the fully-qualified class name is used, which is fine for a
PHP-only fleet but won't line up with a differently-named handler elsewhere.
#[FlareJob(name: 'SendWelcomeEmail')] // explicit, cross-language safe
#[FlareJob] // wire type = App\Jobs\SendWelcomeEmail
Timeout and heartbeats
timeoutSeconds is the per-attempt deadline. The worker also uses it to set
the heartbeat cadence (max(10s, timeout / 3)), and trips the job's
cancellation handle when the deadline passes.
Recurring fields
cron and timezone apply only to recurring jobs. Always
provide a timezone for non-UTC schedules.