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)4194.1k↓40.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 3d 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 87% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity44

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

1211d 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://avatars.githubusercontent.com/u/8309411?v=4)[Adrian Falleiro](/maintainers/adrianfalleiro)[@adrianfalleiro](https://github.com/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

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[cakephp/cakephp

The CakePHP framework

8.9k19.5M1.8k](/packages/cakephp-cakephp)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k39](/packages/neuron-core-neuron-ai)[buggregator/trap

A simple and powerful tool for debugging PHP applications.

2702.2M68](/packages/buggregator-trap)[phlak/directory-lister

PHP directory lister

2.5k1.4k](/packages/phlak-directory-lister)

PHPackages © 2026

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