Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Jobpipeline

Jobpipeline Laravel Package

stancl/jobpipeline

Turn any series of Laravel jobs into an event listener. Build pipelines that pull data from events, run jobs sequentially, and choose sync or queued execution (with optional queue name). Ideal for workflows like tenant setup, migrations, and seeding.

View on GitHub
Deep Wiki
Context7

stancl/jobpipeline provides a compact JobPipeline class that turns any sequence of Laravel jobs into a reusable event listener. Define the jobs, map an event to the payload via send(), and run the pipeline synchronously or queued—all with a fluent API.

Use pipelines in EventServiceProvider::$listen or with Event::listen() to keep orchestration logic clean and composable.

  • Convert a series of jobs into a single listener
  • Map event data to job input with send(Closure)
  • Run sync by default or enable queueing with shouldBeQueued()
  • Set a global default via JobPipeline::$shouldBeQueuedByDefault
  • Optionally dispatch to a specific queue name
Frequently asked questions about Jobpipeline
How do I convert a series of Laravel jobs into an event listener using stancl/jobpipeline?
Use `JobPipeline::make([Job1::class, Job2::class])` to define your job sequence, then chain `.send()` to map event data to job inputs. Register the pipeline as a listener in `EventServiceProvider::$listen` or via `Event::listen()`. Example: `JobPipeline::make([CreateDatabase::class, MigrateDatabase::class])->send(fn($event) => $event->tenant).`
Does stancl/jobpipeline support Laravel 13? What are the version requirements?
Yes, stancl/jobpipeline supports Laravel 11–13. Check the package’s `composer.json` for exact version constraints, but it’s designed to work across these releases without framework modifications. Always verify compatibility with your Laravel version.
Can I queue individual jobs in a pipeline to different queues?
No, the entire pipeline is queued to a single queue (specified via `shouldBeQueued(true, 'queue-name')`). However, you can use conditional logic in the `send()` closure to dynamically adjust job inputs or leverage job-specific queue logic inside each job’s `handle()` method.
How do I handle failures in a job pipeline? Does it retry failed jobs?
Pipelines short-circuit on job failure (return `false` to stop execution). Use Laravel’s `failed_jobs` table for retries or implement compensation logic in a separate job. For critical workflows, combine with `shouldQueue()` and monitor the `failed_jobs` table.
Is there a way to test job pipelines without hitting the queue?
Yes, pipelines run synchronously by default. Test them directly by triggering the event in your tests: `Bus::dispatch(new TenantCreated($tenant));`. Mock the jobs or use `JobPipeline::make()->toListener()` to isolate pipeline logic for unit tests.
Can I use stancl/jobpipeline for conditional workflows (e.g., skip a job based on user role)?
Not natively—pipelines execute jobs sequentially without branching. For conditional logic, use the `send()` closure to filter data or dynamically inject jobs via `array_merge()` before creating the pipeline. Example: `JobPipeline::make(array_merge([$baseJobs], $conditionalJobs))`.
How does stancl/jobpipeline compare to spatie/laravel-sagas for workflows?
stancl/jobpipeline is simpler and Laravel-native, ideal for linear, sequential workflows (e.g., tenant provisioning). spatie/laravel-sagas offers more advanced features like compensation transactions and parallel steps but adds complexity. Choose stancl/jobpipeline for lightweight, event-driven pipelines.
Will job pipelines work with custom job dependencies (e.g., jobs that require other jobs to complete)?
Yes, pipelines enforce sequential execution, so each job depends on the previous one’s success. If a job fails, the pipeline stops. For complex dependencies, ensure jobs are idempotent or use the `send()` closure to pass intermediate results explicitly.
Can I log intermediate steps in a job pipeline for debugging?
No direct logging method exists, but you can inject logging into individual jobs or use Laravel’s logging facade inside the `send()` closure. For observability, consider wrapping the pipeline in middleware or using `JobPipeline::make()->withMiddleware()` to add custom logic.
How do I migrate from monolithic jobs to job pipelines in an existing Laravel app?
Start by auditing jobs for sequential dependencies. Replace one monolithic job with a pipeline (e.g., `JobPipeline::make([Step1::class, Step2::class])`), then gradually refactor others. Use feature flags to toggle between old and new workflows during migration. Test pipelines in staging first.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport