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 1mo ago

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

1156d 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

[wp-cli/wp-cli

WP-CLI framework

5.1k17.2M320](/packages/wp-cli-wp-cli)[consolidation/annotated-command

Initialize Symfony Console commands from annotated command class methods.

22569.8M19](/packages/consolidation-annotated-command)[seld/cli-prompt

Allows you to prompt for user input on the command line, and optionally hide the characters they type

24725.8M17](/packages/seld-cli-prompt)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[php-tui/php-tui

Comprehensive TUI library heavily influenced by Ratatui

589747.0k6](/packages/php-tui-php-tui)[codedungeon/php-cli-colors

Liven up you PHP Console Apps with standard colors

10210.1M26](/packages/codedungeon-php-cli-colors)

PHPackages © 2026

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