PHPackages                             mxl/laravel-job - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. mxl/laravel-job

ActiveLibrary[Queues &amp; Workers](/categories/queues)

mxl/laravel-job
===============

Laravel job tools

v1.8.0(2mo ago)661.4M↓17.7%7MITPHPPHP &gt;=7.0CI failing

Since Sep 26Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/mxl/laravel-job)[ Packagist](https://packagist.org/packages/mxl/laravel-job)[ Docs](https://github.com/mxl/laravel-job)[ RSS](/packages/mxl-laravel-job/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (4)Versions (13)Used By (0)

laravel-job
===========

[](#laravel-job)

[![Current version](https://camo.githubusercontent.com/285b183d31e545e6c19deb46313c05bd2f220d5d3dbaeaafdc560c75129a038b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d786c2f6c61726176656c2d6a6f622e7376673f6c6f676f3d636f6d706f736572)](https://packagist.org/packages/mxl/laravel-job)[![Monthly Downloads](https://camo.githubusercontent.com/5c1afa81b39b2762c69400b1a2933868147ceceb6ffa120b90e21cd8f715df5f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6d786c2f6c61726176656c2d6a6f622e737667)](https://packagist.org/packages/mxl/laravel-job/stats)[![Total Downloads](https://camo.githubusercontent.com/cb8ea24cf01c630dec4cd583c80f777f17f8b2b67af794571098a7558cfe4bb2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d786c2f6c61726176656c2d6a6f622e737667)](https://packagist.org/packages/mxl/laravel-job/stats)[![Build Status](https://camo.githubusercontent.com/c3c81b67b1f47c138a1ec04f8756f7fe8578fa0200c5f39d8a036c8b71a3957c/68747470733a2f2f7472617669732d63692e6f72672f6d786c2f6c61726176656c2d6a6f622e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mxl/laravel-job)

Laravel job tools:

- dispatch job from command line with parameters to queue or run synchronously;
- `Job` base class with boilerplate.

Installation
------------

[](#installation)

```
$ composer require mxl/laravel-job
```

Laravel 5.5+ will use the [auto-discovery](https://medium.com/@taylorotwell/package-auto-discovery-in-laravel-5-5-ea9e3ab20518) feature to add `MichaelLedin\LaravelJob\LaravelJobServiceProvider::class` to providers.

This package is not compatible with older Laravel versions.

Usage
-----

[](#usage)

### Dispatching job from command line to the queue

[](#dispatching-job-from-command-line-to-the-queue)

Make sure that you either use `sync` connection (see `default` property in `config/queue.php`) or run queue worker:

```
$ php artisan queue:work
```

Then dispatch command with:

```
$ php artisan job:dispatch YourJob
```

if `YourJob` class is located under `\App\Jobs` or specify full class name with namespace:

```
$ php artisan job:dispatch '\Path\To\YourJob'
```

### Running jobs immediately

[](#running-jobs-immediately)

If you want to run job right now without posting it to queue use `job:dispatchNow` command:

```
$ php artisan job:dispatchNow YourJob
```

### Dispatching jobs with parameters

[](#dispatching-jobs-with-parameters)

```
$ php artisan job:dispatch YourJob John 1990-01-01
```

`John` and `1990-01-01` values will be passed to `YourJob` constructor as `$name` and `$birthDate` arguments:

```
class YourJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    __constructor($name, $birthDate)
   {
       // ...
   }

   public function handle()
   {
       // ...
   }
}
```

### Using job with parameters from command line and PHP code

[](#using-job-with-parameters-from-command-line-and-php-code)

Often a job is already in use somewhere from PHP code and if it has constructor arguments that must have specific type, then it can be required to parse command line parameters.

For this purpose implement `FromParameters` interface:

```
use MichaelLedin\LaravelJob\FromParameters;
use Carbon\Carbon;

class YourJob implements ShouldQueue, FromParameters
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    __constructor(string $name, Carbon $birthDate)
    {
        // ...
    }

    public function handle()
    {
        // ...
    }

    public static function fromParameters(...$parameters)
    {
        return new self($parameters[0], Carbon::parse($parameters[1]));
    }
}
```

### Job boilerplate

[](#job-boilerplate)

Job classes always use the same interface `ShouldQueue` and `Dispatchable`, `InteractsWithQueue`, `Queueable`, `SerializesModels` traits.

To avoid such boilerplate your jobs can extend `MichaelLedin\LaravelJob\Job` class:

```
use MichaelLedin\LaravelJob\Job;
use Carbon\Carbon;

class YourJob extends Job
{
    // ...
}
```

It also includes default `FromParameters` interface implementation that is equivalent to calling constructor with arguments provided by command line parameters without any parsing.
To add parsing override `fromParameters` method.

Maintainers
-----------

[](#maintainers)

- [@mxl](https://github.com/mxl)

Other useful Laravel packages from the author
---------------------------------------------

[](#other-useful-laravel-packages-from-the-author)

- [mxl/laravel-api-key](https://github.com/mxl/laravel-api-key) - API Key Authorization for Laravel with replay attack prevention;
- [mxl/laravel-queue-rate-limit](https://github.com/mxl/laravel-queue-rate-limit) - simple Laravel queue rate limiting;

License
-------

[](#license)

See the [LICENSE](https://github.com/mxl/laravel-job/blob/master/LICENSE) file for details.

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance87

Actively maintained with recent releases

Popularity53

Moderate usage in the ecosystem

Community15

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 70% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~219 days

Recently: every ~295 days

Total

12

Last Release

66d ago

Major Versions

v0.0.2 → v1.0.02019-09-26

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1078685?v=4)[Michael Ledin](/maintainers/mxl)[@mxl](https://github.com/mxl)

---

Top Contributors

[![mxl](https://avatars.githubusercontent.com/u/1078685?v=4)](https://github.com/mxl "mxl (14 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (4 commits)")[![EnhydraV](https://avatars.githubusercontent.com/u/36769987?v=4)](https://github.com/EnhydraV "EnhydraV (1 commits)")[![repat](https://avatars.githubusercontent.com/u/516807?v=4)](https://github.com/repat "repat (1 commits)")

---

Tags

laraveljobcommandtoolsdispatch

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mxl-laravel-job/health.svg)

```
[![Health](https://phpackages.com/badges/mxl-laravel-job/health.svg)](https://phpackages.com/packages/mxl-laravel-job)
```

###  Alternatives

[lorisleiva/laravel-actions

Laravel components that take care of one specific task

2.9k8.8M193](/packages/lorisleiva-laravel-actions)[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11223.5M33](/packages/anourvalar-eloquent-serialize)[mpbarlow/laravel-queue-debouncer

A wrapper job for debouncing other queue jobs.

63825.7k1](/packages/mpbarlow-laravel-queue-debouncer)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21318.6k3](/packages/ecotone-laravel)[tochka-developers/queue-promises

Promises for Laravel queue jobs

1912.3k](/packages/tochka-developers-queue-promises)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
