PHPackages                             mortenscheel/task-flow - 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. [CLI &amp; Console](/categories/cli)
4. /
5. mortenscheel/task-flow

ActiveLibrary[CLI &amp; Console](/categories/cli)

mortenscheel/task-flow
======================

Pipeline for nested console tasks

0.2.0(1y ago)83[2 issues](https://github.com/mortenscheel/task-flow/issues)MITPHPPHP ^8.3.0

Since Dec 29Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mortenscheel/task-flow)[ Packagist](https://packagist.org/packages/mortenscheel/task-flow)[ RSS](/packages/mortenscheel-task-flow/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (15)Versions (3)Used By (0)

 [![GitHub Workflow Status (master)](https://github.com/mortenscheel/task-flow/actions/workflows/tests.yml/badge.svg)](https://github.com/mortenscheel/task-flow/actions) [![Total Downloads](https://camo.githubusercontent.com/16e6b6be23209fdadaae5db18ec02056624373159a1343412597ec706158044a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6f7274656e73636865656c2f7461736b2d666c6f77)](https://packagist.org/packages/mortenscheel/task-flow) [![Latest Version](https://camo.githubusercontent.com/7d6d3320ca93e0401c72e6aaa84e1aa8ca8b3a805a8b583b22ac131eed61d960/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6f7274656e73636865656c2f7461736b2d666c6f77)](https://packagist.org/packages/mortenscheel/task-flow) [![License](https://camo.githubusercontent.com/32baa27f1232a23ce735a3245d93eef122b7e068f445716d80444b3c32e7ef69/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d6f7274656e73636865656c2f7461736b2d666c6f77)](https://packagist.org/packages/mortenscheel/task-flow)

Task Flow
=========

[](#task-flow)

Build dynamic nested console workflows with ease.

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

[](#installation)

You can install the package via composer:

```
composer require mortenscheel/task-flow
```

Getting started
---------------

[](#getting-started)

### Example flow

[](#example-flow)

[![Example](assets/example.gif)](assets/example.gif)

### Laravel example

[](#laravel-example)

```
use Scheel\TaskFlow\Context;
use Scheel\TaskFlow\Facades\TaskFlow;
use Scheel\TaskFlow\Task;

TaskFlow::run([
    Task::make('Closure', function (Context $context) {
        // Do stuff
        usleep(500000);
        // Set context data for future tasks
        $context->set('foo', true);
    }),
    Task::make('Conditional', function (Context $context) {
        // Read context data from previous tasks
        if ($context->get('foo')) {
            // Skip current task, including child tasks
            $context->skip();
        }
    }),

    // Task action can be an invokable class
    Task::make('Invokable', new SomeInvokable),
    Task::make('Nested tasks', children: [
        Task::make('Subtask 1', $this->classMethod(...)),
        Task::make('Subtask 2', children: [
            Task::make('Subtask 2.1', children: [
                Task::make('Subtask 2.1.1', fn () => sleep(1)),
                Task::make('Subtask 2.1.2', fn () => sleep(1)),
            ]),
            Task::make('Subtask 2.2', fn () => sleep(1)),
        ]),
    ]),
    Task::make('Final task', fn () => sleep(1)),
]);
```

### Standalone example

[](#standalone-example)

```
use Scheel\TaskFlow\Renderer\ConsoleRenderer;
use Scheel\TaskFlow\Task;
use Scheel\TaskFlow\TaskManager;
use Symfony\Component\Console\Output\ConsoleOutput;

// The TaskManager has to be constructed manually
$manager = new TaskManager(new ConsoleRenderer(new ConsoleOutput()));
// But the rest of the API is the same, whether you use Laravel or not
$manager->run([
    Task::make('Task 1', fn (): null => null),
    Task::make('Task 2', children: [
        Task::make('Task 2.1', fn (): null => null),
        Task::make('Task 2.2', children: [
            Task::make('Task 2.2.1', fn () => fn(): null => null),
        ]),
    ]),
    Task::make('Task 3', fn (): null => null),
]);
```

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

[](#configuration)

The default configuration is as follows:

```
[
    'indent' => 2,
    'symbols' => [
        'pending' => '…',
        'running' => '▶',
        'completed' => '✓',
        'skipped' => '⏭',
        'failed' => '✗',
    ],
    'colors' => [
        'pending' => 'gray',
        'running' => 'bright-white',
        'completed' => 'green',
        'skipped' => 'yellow',
        'failed' => 'red',
    ],
]
```

### Laravel

[](#laravel)

You can publish the config file with:

```
php artisan vendor:publish --provider="Scheel\TaskFlow\TaskFlowServiceProvider" --tag="config"
```

### Standalone

[](#standalone)

You can pass a custom configuration array to the `ConsoleRenderer` constructor:

```
$manager = new TaskManager(new ConsoleRenderer(new ConsoleOutput(), [
    'symbols' => [
        'pending' => '💤',
        'running' => '🏃‍♂️️',
        'completed' => '🎉',
        'failed' => '😭',
        'skipped' => '⏩',
    ]
]));
```

Task Context
------------

[](#task-context)

The `Context` is a shared object, which is passed to all task actions.

- `set(string $key, mixed $value): void` - Set a value in the context for use by future tasks.
- `get(string $key): mixed` - Get a value from the context, provided by previous tasks.
- `has(string $key): bool` - Check if a key exists in the context.
- `increment(string $key, int $amount = 1): void` - Increment a value in the context.
- `skip(): void` - Skip the current task, including all child tasks.
- `updateTitle(string $title): void` - Update the title of the current task.
- `abort(): void` - Abort the entire task flow. This has the same effect as throwing an exception.
- `interactive(callable $callback): mixed` - Allows for user interaction, without interfering with the task flow status output.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

550d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6514342?v=4)[Morten Scheel](/maintainers/mortenscheel)[@mortenscheel](https://github.com/mortenscheel)

---

Top Contributors

[![mortenscheel](https://avatars.githubusercontent.com/u/6514342?v=4)](https://github.com/mortenscheel "mortenscheel (10 commits)")

---

Tags

consolelaravelphpphpconsolerendererpipeline

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mortenscheel-task-flow/health.svg)

```
[![Health](https://phpackages.com/badges/mortenscheel-task-flow/health.svg)](https://phpackages.com/packages/mortenscheel-task-flow)
```

###  Alternatives

[psy/psysh

An interactive shell for modern PHP.

9.8k582.3M821](/packages/psy-psysh)[nunomaduro/collision

Cli error handling for console/command-line PHP applications.

4.7k357.7M11.1k](/packages/nunomaduro-collision)[nunomaduro/phpinsights

Instant PHP quality checks from your console.

5.6k11.7M494](/packages/nunomaduro-phpinsights)

PHPackages © 2026

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