A better way to create complex batch job queues in Laravel.

Related tags

Task Runners relay
Overview

Relay

A better way to create complex batch job queues in Laravel.

Installation

composer require agatanga/relay

Usage Example

Let's say you have the following job batches code:

Bus::batch([
    [
        new DownloadSources($project),
        new DetectSettings($project),
    ],
])->then(function (Batch $batch) use ($project) {
    Bus::batch([
        new ReadStringFiles($project),
        new ReadSourceFiles($project),
    ])->then(function (Batch $batch) use ($project) {
        Bus::batch([
            new IgnoreKnownStrings($project),
            new RemoveSources($project),
        ])->name('Update Project (3 of 3)')->dispatch();
    })->name('Update Project (2 of 3)')->dispatch();
})->name('Update Project (1 of 3)')->dispatch();

Here is the same code written with Relay:

(new \Agatanga\Relay\Relay)
    ->name('Update Project (:current of :total)')
    ->chain([
        new DownloadSources($project),
        new DetectSettings($project),
    ])
    ->batch([
        new ReadStringFiles($project),
        new ReadSourceFiles($project),
    ])
    ->batch([
        new IgnoreKnownStrings($project),
        new RemoveSources($project),
    ])
    ->dispatch();
You might also like...
Easily implement optimistic Eloquent model locking feature to your Laravel app.

quarks/laravel-locking Easily implement optimistic Eloquent model locking feature to your Laravel app. Installation composer require quarks/laravel-lo

A simple job posting application using PHP with an Admin Panel. Register, Login and create the job in apnel. The job gets posted on index page.

Jobee A simple job posting application using PHP with an Admin Panel. Register, Login and create the job in apnel. The job gets posted on index page.

insert batch and update batch in laravel

Laravel BATCH (BULK) Insert and update batch (bulk) in laravel Install composer require mavinoo/laravel-batch Service Provider file app.php in array p

YCOM Impersonate. Login as selected YCOM user πŸ§™β€β™‚οΈin frontend.

YCOM Impersonate Login as selected YCOM user in frontend. Features: Backend users with admin rights or YCOM[] rights, can be automatically logged in v

Job Portal - Find your dream job here Various career opportunities await you
Job Portal - Find your dream job here Various career opportunities await you

Find your dream job here Various career opportunities await you. Find the right career and connect with companies anytime, anywhere 🎯 free access to search for jobs, post resumes, and research companies. 🎊

Better Moderation, moderation just done better.

Better Moderation Plugin Commands /ban player reason time - Bans a player from the server. /blacklist player - Blacklists a player from the se

A better way to create WordPress themes.

Runway Framework for WordPress Visit the Runway website: RunwayWP.com A better way to create WordPress themes. Runway was built for creating WordPress

Dashboard and code-driven configuration for Laravel queues.

Introduction Horizon provides a beautiful dashboard and code-driven configuration for your Laravel powered Redis queues. Horizon allows you to easily

Perform Bulk/Batch Update/Insert/Delete with laravel.

Bulk Query Perform Bulk/Batch Update/Insert/Delete with laravel. Problem I tried to make bulk update with laravel but i found that Laravel doesn't sup

Redis repository implementation for Laravel Queue Batch

Laravel RedisBatchRepository Replaces default Illuminate\Bus\DatabaseBatchRepository with implementation based on Redis. Requirements: php 8 laravel 8

Projeto feito em Laravel/Framework com o intuito de aprender usar as Queues para disparo de e-mails.

Filas do Laravel Projeto feito em Laravel/Framework com o intuito de aprender usar as Queues para disparo de e-mails. Bibliotecas usadas: Laravel pt-B

Durable workflow engine that allows users to write long running persistent distributed workflows in PHP powered by Laravel queues

Durable workflow engine that allows users to write long running persistent distributed workflows (orchestrations) in PHP powered by Laravel queues. Inspired by Temporal and Azure Durable Functions.

Venture allows you to create and manage complex, async workflows in your Laravel apps.

Venture is a package to help you build and manage complex workflows of interdependent jobs using Laravel's queueing system. Installation Note: Venture

:racehorse: find the size of an image without downloading the whole file. Supports batch requests.

FasterImage FasterImage finds the dimensions or filetype of a remote image file given its uri by fetching as little as needed, based on the excellent

Load-Balance PaperCut ETP Print Queues using Postfix

ETP Load Balancing for PaperCut using Postfix This script is designed to allow you to load balance a single Email-To-Print address against multiple pr

There is no better way to learn than by watching other developers code live. Find out who is streaming next in the Laravel world.
There is no better way to learn than by watching other developers code live. Find out who is streaming next in the Laravel world.

Larastreamers This is the repository of https://larastreamers.com. It shows you who is live coding next in the Laravel world. Installation Steps clone

Validate your input data in a simple way, an easy way and right way. no framework required. For simple or large. project.

wepesi_validation this module will help to do your own input validation from http request POST or GET. INTEGRATION The integration is the simple thing

Small Library to Serve Images in PHP in a Better Way (Resize, Compress) with Caching Support

A library for serving images and optimizing, changing their sizes, this library uses the caching feature, and in addition, it is very fast and small in size. In addition to these features, this library also optimizes images.

Create material deisgn avatars for users just like Google Messager. It may not be unique but looks better than Identicon or Gravatar.
Create material deisgn avatars for users just like Google Messager. It may not be unique but looks better than Identicon or Gravatar.

Material-Design-Avatars Create material deisgn avatars for users just like Google Messager. It may not be unique but looks better than Identicon or Gr

Comments
  • 1.0.0

    1.0.0

    I'd like to change the API to be closer to Laravel's Batch API, and add additional features:

    • [x] Use then and finally methods (currently you cannot use finally)
    • [x] Allow setting different names for each of the batches
    • [x] Allow filtering batches by metadata
    • [x] Get correct progress

    New version of that one that's used in the readme:

    Relay::batch([
            [
                new DownloadSources($project),
                new DetectSettings($project),
            ]
        ])
        ->then([
            new ReadStringFiles($project),
            new ReadSourceFiles($project),
        ])
        ->then([
            new IgnoreKnownStrings($project),
            new RemoveSources($project),
        ])
        ->name('Update Project') //  [:current/:total] will be added automatically
        ->dispatch();
    

    Different names, metadata

    Relay::batch('Downloading Sources', [
            [
                new DownloadSources($project),
                new DetectSettings($project),
            ]
        ])
        ->then('Processing Files', [
            new ReadStringFiles($project),
            new ReadSourceFiles($project),
        ])
        ->then('Cleanup', [
            new IgnoreKnownStrings($project),
            new RemoveSources($project),
        ])
        ->meta([
            'project.update' => $project->id,
            'causer' => $user->id
        ])
        ->dispatch();
    

    Find job batches

    Relay::whereMeta('project', 5)->whereMeta('causer', 1)->first();
    Relay::whereMeta('project.update')->all(); // get all project.update job batches
    Relay::whereMeta('project.update', 5)->all(); // get project.update batches for project_id=5
    Relay::whereMeta('causer', 1)->all(); // get all batches started by user_id=1
    
    opened by vovayatsyuk 0
Owner
Agatanga
Localization Management App
Agatanga
PHP cron job scheduler

PHP Cron Scheduler This is a framework agnostic cron jobs scheduler that can be easily integrated with your project or run as a standalone command sch

Giuseppe Occhipinti 698 Jan 1, 2023
Cron Job Manager for Magento 2

EthanYehuda_CronJobManager A Cron Job Management and Scheduling tool for Magento 2 Control Your Cron Installation In your Magento2 root directory, you

Ethan Yehuda 265 Nov 24, 2022
A PHP-based job scheduler

Crunz Install a cron job once and for all, manage the rest from the code. Crunz is a framework-agnostic package to schedule periodic tasks (cron jobs)

null 58 Dec 26, 2022
Create a docker container where various tasks are performed with different frequencies

?? Docker with task scheduler Introduction The goal is to create a docker container where various tasks are performed with different frequencies. For

Green.Mod 3 Jun 7, 2022
Laravel-Tasks is a Complete Build of Laravel 5.2 with Individual User Task Lists

An app of tasks lists for each individual user. Built on Laravel 5.2, using 5.2 authentication and middleware. This has robust verbose examples using Laravel best practices.

Jeremy Kenedy 26 Aug 27, 2022
Laravel Cron Scheduling - The ability to run the Laravel task scheduler using different crons

Laravel Cron Scheduling Laravel Task Scheduling is a great way to manage the cron. But the documentation contains the following warning: By default, m

Sergey Zhidkov 4 Sep 9, 2022
Dispatcher is a Laravel artisan command scheduling tool used to schedule artisan commands within your project so you don't need to touch your crontab when deploying.

Dispatcher Dispatcher allows you to schedule your artisan commands within your Laravel project, eliminating the need to touch the crontab when deployi

Indatus 1.1k Jan 5, 2023
Manage Your Laravel Schedule From A Web Dashboard

Introduction Manage your Laravel Schedule from a pretty dashboard. Schedule your Laravel Console Commands to your liking. Enable/Disable scheduled tas

β“’β“žβ““β“” β“’β“£β“€β““β“˜β“ž 1.6k Jan 5, 2023
Manage Your Laravel Schedule From A Web Dashboard

Introduction Manage your Laravel Schedule from a pretty dashboard. Schedule your Laravel Console Commands to your liking. Enable/Disable scheduled tas

β“’β“žβ““β“” β“’β“£β“€β““β“˜β“ž 1.6k Jan 1, 2023
Manage your Laravel Task Scheduling in a friendly interface and save schedules to the database.

Documentation This librarian creates a route(default: /schedule) in your application where it is possible to manage which schedules will be executed a

Roberson Faria 256 Dec 21, 2022