PHPackages                             greencape/repl - 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. greencape/repl

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

greencape/repl
==============

A generic Read-Eval-Print Loop for PHP

1.0.0(3y ago)08MITPHP

Since Mar 20Pushed 3y ago1 watchersCompare

[ Source](https://github.com/GreenCape/REPL)[ Packagist](https://packagist.org/packages/greencape/repl)[ RSS](/packages/greencape-repl/feed)WikiDiscussions main Synced yesterday

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

Read-Eval-Print Loop (REPL) for PHP
===================================

[](#read-eval-print-loop-repl-for-php)

GreenCape REPL is a simple Read-Eval-Print Loop (REPL) written in PHP. It can be combined with arbitrary evaluators for the Eval step.

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

[](#installation)

```
composer require greencape/repl
```

Usage
-----

[](#usage)

Create an Evaluator implementing the `GreenCape\REPL\EvaluatorInterface` and pass it to the REPL:

```
use GreenCape\REPL\EvaluatorInterface;
use GreenCape\REPL\ReadEvalPrintLoop;

class MyEvaluator implements EvaluatorInterface
{
    public function init(): void {}
    public function exit(): void {}
    public function eval(string $input): string
    {
        // Handle the input and return the result
        return $result;
    }
}

$evaluator = new MyEvaluator();
$repl      = new ReadEvalPrintLoop($evaluator);

$repl->run();
```

With `init()` and `exit()` you can implement a setup and teardown for the REPL.

The loop will read your input after a '&gt; ' prompt' and send it to the `eval()` method of the Evaluator. The result will be printed to the console. You can enter multi line input by ending each line with a backslash. Continuation lines are indicated by a '&gt;&gt; ' prompt.

To terminate the loop, enter `exit`.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

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

Unknown

Total

1

Last Release

1201d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/84f7f05685e84e3fe971d8d005bb74e766204799c50a7b45036af27436cecddc?d=identicon)[GreenCape](/maintainers/GreenCape)

---

Top Contributors

[![nibra](https://avatars.githubusercontent.com/u/827605?v=4)](https://github.com/nibra "nibra (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/greencape-repl/health.svg)

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

###  Alternatives

[illuminate/console

The Illuminate Console package.

13046.0M6.5k](/packages/illuminate-console)[styleci/cli

The CLI tool for StyleCI

71470.5k9](/packages/styleci-cli)[winbox/args

Windows command-line formatter

20720.9k21](/packages/winbox-args)[tomatophp/filament-artisan

Simple but yet powerful library for running some artisan commands for FilamentPHP

3275.4k1](/packages/tomatophp-filament-artisan)

PHPackages © 2026

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