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

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

paulhenri-l/laravel-task-runner
===============================

Helps you compose command workflows as a set of tasks

3.1.1(4y ago)04.5k1MITPHPPHP ^7.3|^8.0CI failing

Since Jun 13Pushed 4y agoCompare

[ Source](https://github.com/paulhenri-l/laravel-task-runner)[ Packagist](https://packagist.org/packages/paulhenri-l/laravel-task-runner)[ RSS](/packages/paulhenri-l-laravel-task-runner/feed)WikiDiscussions master Synced 3w ago

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

LaravelTaskRunner
=================

[](#laraveltaskrunner)

[![Tests](https://github.com/paulhenri-l/laravel-task-runner/workflows/Tests/badge.svg)](https://github.com/paulhenri-l/laravel-task-runner/workflows/Tests/badge.svg)[![License: MIT](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](LICENSE)

This tool will help you run a defined set of tasks in your commands. It's useful in cases where your commands needs to consequently run different operations.

This tool is used inside both [LaravelEngine](https://github.com/paulhenri-l/laravel-engine) and the [PHL Console](https://github.com/paulhenri-l/console).

Example
-------

[](#example)

```
php artisan my-command

[Some\Namespace\MyFirstTask]
Hello from MyFirstTask.

[Some\Namespace\MySecondTask]
MySecondTask Complete.

Installation done 🎉
```

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

[](#installation)

```
composer require paulhenri-l/laravel-task-runner
```

Usage
-----

[](#usage)

In order to use the TaskRunner you need to add the `CanRunTasks` trait to your command and call the `runTasks` method.

The only argument is the array of tasks you want to run. A task is an invokable class. You can either pass instances of tasks or their classname.

*If you pass in a classname the task will be resolved through laravel's container, so you can type hint any dependency you may need in your task's constructor.*

### Use the trait

[](#use-the-trait)

```
