PHPackages                             adrianfalleiro/slim-cli-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. adrianfalleiro/slim-cli-runner

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

adrianfalleiro/slim-cli-runner
==============================

Run command line tasks for Slim PHP

3.2.0(3y ago)4290.6k↓28.1%13[1 issues](https://github.com/adrianfalleiro/slim-cli-runner/issues)[2 PRs](https://github.com/adrianfalleiro/slim-cli-runner/pulls)2MITPHPPHP &gt;=7.1

Since Dec 22Pushed 2y ago5 watchersCompare

[ Source](https://github.com/adrianfalleiro/slim-cli-runner)[ Packagist](https://packagist.org/packages/adrianfalleiro/slim-cli-runner)[ RSS](/packages/adrianfalleiro-slim-cli-runner/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (5)Versions (10)Used By (2)

Slim CLI Runner
===============

[](#slim-cli-runner)

Create and run command line tasks for the Slim PHP micro-framework

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

[](#installation)

**Installation**

```
composer require adrianfalleiro/slim-cli-runner ^3.1

```

*For Slim 3 support install version 2.6 or lower*

**Register Middleware**

Register the middleware in `middleware.php`

```
$app->add(new adrianfalleiro\SlimCliRunner\CliRunner::class);
```

Define, Register and run your tasks
-----------------------------------

[](#define-register-and-run-your-tasks)

**Task definition**

Tasks are classes which extend `CliAction` and have a public `command()` method.

You can inject dependencies through the class constructor.

```
use Psr\Http\Message\ResponseInterface as Response;
use adrianfalleiro\SlimCliRunner\CliAction;

use Psr\Log\LoggerInterface;

class ExampleCliAction extends CliAction
{
    public function __construct(LoggerInterface $logger)
    {
        $this->logger = $logger;
    }

    protected function action(): Response
    {
        $arg0 = $this->resolveArg(0);
        $this->logToConsole("arg 0 is {$arg0}");

        return $this->respond();
    }
}
```

**Tasks registration**

Add a new key in your `settings.php` definitions file called `commands` and list your tasks. To define a default task (For use when no command name is provided) add a new task with `__default` as key

```
return function (ContainerBuilder $containerBuilder) {
    // Global Settings Object
    $containerBuilder->addDefinitions([
        'settings' => [
            ...
        ],
        'commands' => [
            '__default' => \Namespace\To\Task::class
            'SampleTask' => \Namespace\To\Task::class
        ]
    ]);
};
```

**Run Tasks**

There are multiple ways of doing this:
Directly via command line:

```
php public/index.php SampleTask arg1 arg2 arg3

```

Via composer:
*composer.json*

```
{
    /*...*/
    "config": {
        "process-timeout" : 0
    },
    "scripts": {
        /*...*/
        "cli": "php public/index.php"
    }
}
```

*The command*

```
composer cli SampleTask argument1 argument2 argument3

```

Examples
--------

[](#examples)

An example project can be found in the `examples/` folder

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity43

Moderate usage in the ecosystem

Community24

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 78% 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 ~324 days

Recently: every ~360 days

Total

8

Last Release

1164d ago

Major Versions

2.6 → 3.02020-06-27

PHP version history (2 changes)2.0PHP &gt;=5.5.0

3.0PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/af47b1cf977ff9a8fa849313d830b99f122948ddd6d6dc02a7b23b79085e4b36?d=identicon)[adrianfalleiro](/maintainers/adrianfalleiro)

---

Top Contributors

[![adrianfalleiro](https://avatars.githubusercontent.com/u/8309411?v=4)](https://github.com/adrianfalleiro "adrianfalleiro (32 commits)")[![LauraRozier](https://avatars.githubusercontent.com/u/12035362?v=4)](https://github.com/LauraRozier "LauraRozier (4 commits)")[![benrogmans](https://avatars.githubusercontent.com/u/394374?v=4)](https://github.com/benrogmans "benrogmans (1 commits)")[![naveed125](https://avatars.githubusercontent.com/u/5105844?v=4)](https://github.com/naveed125 "naveed125 (1 commits)")[![whizsid](https://avatars.githubusercontent.com/u/44908250?v=4)](https://github.com/whizsid "whizsid (1 commits)")[![jeroenvreuls](https://avatars.githubusercontent.com/u/28493602?v=4)](https://github.com/jeroenvreuls "jeroenvreuls (1 commits)")[![arnebratt](https://avatars.githubusercontent.com/u/1096883?v=4)](https://github.com/arnebratt "arnebratt (1 commits)")

---

Tags

clislim

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/adrianfalleiro-slim-cli-runner/health.svg)

```
[![Health](https://phpackages.com/badges/adrianfalleiro-slim-cli-runner/health.svg)](https://phpackages.com/packages/adrianfalleiro-slim-cli-runner)
```

###  Alternatives

[symfony/console

Eases the creation of beautiful and testable command line interfaces

9.8k1.1B11.3k](/packages/symfony-console)[nunomaduro/collision

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

4.6k331.8M8.5k](/packages/nunomaduro-collision)[nunomaduro/termwind

It's like Tailwind CSS, but for the console.

2.5k239.8M286](/packages/nunomaduro-termwind)[wp-cli/php-cli-tools

Console utilities for PHP

68325.0M367](/packages/wp-cli-php-cli-tools)[buggregator/trap

A simple and powerful tool for debugging PHP applications.

2591.7M40](/packages/buggregator-trap)[acmephp/acmephp

Let's Encrypt client written in PHP

649155.1k](/packages/acmephp-acmephp)

PHPackages © 2026

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