[Feature] Add #[Queueable] Attribute & New Job Dispatching Methods #13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a new PHP attribute,
#[Queueable], which allows developers to explicitly mark a Job class as queueable and define its queue-related configuration directly on the class.Before this change, all jobs extending Job were automatically treated as queueable. With this update, job classes are instant callable by default unless they are decorated with
#[Queueable].In addition, four new static methods have been added to give developers fine-grained control over how a job is dispatched.
New Attribute:
#[Queueable]// Queued — uses Queueable attribute configuration
User can add custom options also as like below
New Dispatching Methods
Four new job dispatching methods give developers explicit control over how and when a job is executed:
Dispatches the job.
Forces the job to run synchronously, even if #[Queueable] is present.
Forces the job to be queued on a specific queue, regardless of class attributes.
Queues the job with a delay (in seconds).
This PR makes job queueing explicit, configurable, and developer-friendly, while introducing a robust attribute-driven API for queue behavior.