PHPackages                             adeildo-jr/laravel-runner - 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. adeildo-jr/laravel-runner

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

adeildo-jr/laravel-runner
=========================

Run system tasks via jobs with a migration-like structure

v1.0.0(2mo ago)00MITPHPPHP ^8.2CI passing

Since Feb 19Pushed 2mo agoCompare

[ Source](https://github.com/adeildo-jr/laravel-runner)[ Packagist](https://packagist.org/packages/adeildo-jr/laravel-runner)[ Docs](https://github.com/adeildo-jr/laravel-runner)[ RSS](/packages/adeildo-jr-laravel-runner/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (8)Versions (3)Used By (0)

Laravel Runner
==============

[](#laravel-runner)

Run system runners via jobs with a migration-like structure. Track runner execution, support database transactions, and run runners via queue or synchronously. Now with PHP 8 Attribute support!

Features
--------

[](#features)

- **Migration-like runners** - Tasks run in filename order and are tracked in the database
- **PHP 8 Attributes** - Configure runners using modern PHP attributes (optional)
- **Transaction support** - Optionally wrap runners in database transactions
- **Queue support** - Run via queue or synchronously
- **Progress tracking** - Track status, output, errors, and timing
- **Idempotent** - Won't re-run completed runners
- **Per-runner queue** - Specify different queues per runner
- **Artisan commands** - Create and run runners via CLI

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

[](#installation)

Install via Composer:

```
composer require adeildo-jr/laravel-runner
```

Publish the configuration file:

```
php artisan vendor:publish --tag="runner-config"
```

Publish and run the migration:

```
php artisan vendor:publish --tag="runner-migrations"
php artisan migrate
```

Create the `Runner` model in your application (if it doesn't exist):

```
# Copy the stub to your app/Models directory
cp vendor/adeildo-jr/laravel-runner/stubs/RunnerModel.stub app/Models/Runner.php
```

Configuration
-------------

[](#configuration)

The configuration file `config/runner.php` contains:

```
return [
    // Path where runners are stored
    'path' => env('RUNNER_PATH', app_path('Runners')),

    // Namespace for runners
    'namespace' => env('RUNNER_NAMESPACE', 'App\\Runners'),

    // Base class that runners must extend
    'base_class' => AdeildoJr\Runner\Runner::class,

    // Eloquent model for tracking runners
    'model' => App\Models\Runner::class,

    // Database table name
    'table' => env('RUNNER_TABLE', 'runners'),
];
```

Usage
-----

[](#usage)

### Creating a Task

[](#creating-a-task)

Use the artisan command to create a new runner:

```
php artisan make:runner SendWelcomeEmails
```

This creates a new runner class in `app/Runners/SendWelcomeEmails.php`.

### Two Ways to Configure Tasks

[](#two-ways-to-configure-tasks)

You can configure runners using either **class properties** (traditional) or **PHP 8 Attributes** (modern). Attributes take precedence over properties when both are present.

#### Option 1: Class Properties (Traditional)

[](#option-1-class-properties-traditional)

```
