PHPackages                             kanfa/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. kanfa/runner

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kanfa/runner
============

Run a callback, or an accessible method of a class by giving the parameters if require

v1.0(8y ago)08MITPHPPHP &gt;=7.1

Since Apr 26Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Kanfa/Runner)[ Packagist](https://packagist.org/packages/kanfa/runner)[ Docs](https://www.github.com/kanfa/Runner)[ RSS](/packages/kanfa-runner/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (1)Versions (4)Used By (0)

Runner [![Build Status](https://camo.githubusercontent.com/10b5ba302f2e6238f3b7cc6c5ab86a4e57260dc0955943b23acf730a7db1c253/68747470733a2f2f7472617669732d63692e6f72672f4b616e66612f52756e6e65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Kanfa/Runner)
==========================================================================================================================================================================================================================================================================

[](#runner-)

Runner is a simple library that run dynamically a callback function, or an accessible method of a class by giving the parameters if require.

How to use
==========

[](#how-to-use)

It creates an array with the following keys:

- "callback" to indicate a callback function
- "class" to indicate the name of a class
- "action" to indicate the name of a method belonging to the instance of the class name indicate as the value for the key "class"
- "params" to indicate the parameters to call

**Callback**

Calling a function without parameters

```
$parameters = [];
$parameters['callback'] = function () {
    echo 'Function Body';
};
$runner = new \Runner\Engine\Runner($parameters);
$runner->run();
```

Function with parameters

```
$parameters = [];
$parameters['callback'] = function ($foo) {
    echo 'Function Body';
};
$parameters['params'] = ['foo']
```

To run, just do it, you have of course in the case of a callback function with the number of parameters given to this function is equal to the number of parameters in the table indexed by key 'params', otherwise throw exception

```
$runner = new \Runner\Engine\Runner();
$runner->run($params);
```

or simply do

```
Runner\Engine\Runner::invokeRun($params);
```

You can add objects to inject as default parameters when create runner instance as follow

if you want to use the default configuration

```
$runner =  Runner\Engine\Runner::createForm(new Class\To\Inject());
```

otherwise

```
$runner =  Runner\Engine\Runner::create('path/to/ini_or_php/file', new Class\To\Inject());
```

this does not work for callback calls

**Class Method**

Same as above, except that instead of a given function of recalls, we give a class name and a method name, if the method exists, it will be called if an exception is thrown

```
$parameters = [];
$parameters['class'] = '\ClassNamespace\FakeClass'
$parameters['action']) = 'find';
$parameters['params'] = ['id']

```

**Use custom class defaults or callback**

You specifies the value (class or callback methods previously created) of the keys defaults\_r or callback\_r in a INI file, after the file path is given as the second constructor parameter to the Runner class.

```
$runner = new \Runner\Engine\Runner(path/to/ini_or_php/file);
```

*Other way to create instance*

```
$runner = \Runner\Engine\Runner::create(path/to/ini_or_php/file);
```

*Singleton*

```
$runner = \Runner\Engine\Runner::singleton(path/to/ini_or_php/file);
```

We can pass a table instead ini or php file

**INI file**

```
default_r = \Custom\DefaultsRunner\FakeClass
callback_r = \Custom\CallbackRunner\FakeClass
```

**PHP file**

```
 '\Custom\DefaultsRunner\FakeClass'
    'callback_r' => '\Custom\CallbackRunner\FakeClass'
];
```

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

2987d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7483402?v=4)[bstylene](/maintainers/bstylene)[@BStylene](https://github.com/BStylene)

---

Top Contributors

[![Kanfa](https://avatars.githubusercontent.com/u/18489216?v=4)](https://github.com/Kanfa "Kanfa (36 commits)")

---

Tags

callbackrunrunnerstartrunrunnercall

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kanfa-runner/health.svg)

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

###  Alternatives

[veewee/composer-run-parallel

Run composer tasks in parallel

92788.7k18](/packages/veewee-composer-run-parallel)[marcelog/pagi

Asterisk Gateway Interface (AGI) client for PHP, suitable to make telephony applications using call flow nodes

190136.2k20](/packages/marcelog-pagi)[cpx/cpx

Run any command from any composer package, even if it's not installed in your project.

40814.5k1](/packages/cpx-cpx)[ttree/scheduler

Simple task scheduler for Neos Flow Framework

21110.4k1](/packages/ttree-scheduler)[maize-tech/laravel-prunable-fields

Laravel Prunable Fields

421.6k](/packages/maize-tech-laravel-prunable-fields)

PHPackages © 2026

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