PHPackages                             whatsdiff/chewie - 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. whatsdiff/chewie

ActiveLibrary

whatsdiff/chewie
================

whatsdiff's fork of joetannenbaum/chewie — a PHP TUI framework built on Laravel Prompts

0.1.13(today)00PHP

Since Aug 4Pushed todayCompare

[ Source](https://github.com/whatsdiff/chewie)[ Packagist](https://packagist.org/packages/whatsdiff/chewie)[ RSS](/packages/whatsdiff-chewie/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (3)Versions (3)Used By (0)

Warning

**This is a fork.** You almost certainly want [`joetannenbaum/chewie`](https://github.com/joetannenbaum/chewie) instead. This repository exists to serve [whatsdiff](https://github.com/whatsdiff/whatsdiff) and is not a general-purpose release of Chewie.

It tracks upstream `main` with two changes:

- `Output\Lines` measures columns with `mb_strwidth()` instead of `mb_strlen()`. Emoji and CJK characters count as one character but occupy two terminal cells, so a column containing them was under-padded and the column beside it drifted out of alignment.
- The hardcoded `version` field is gone from `composer.json`, so Composer can read the version from the tag rather than rejecting any tag that disagrees with the manifest.

Both are meant to go upstream. If they land there, this fork goes away.

[![Chewie](./docs/chewie.jpg)](./docs/chewie.jpg)

Chewie
======

[](#chewie)

Chewie is a package that helps you build text-based user interfaces (TUIs) with [Laravel Prompts](https://laravel.com/docs/prompts). It helps to reduce some of the boilerplate code and adds some helpers for alignment, animation, and more.

Warning

This package is currently in active development. The API is subject to change. Documentation will also improve over time.

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

[](#installation)

```
composer require joetannenbaum/chewie

```

Registering Renderers
---------------------

[](#registering-renderers)

```
use App\Renderers\DemoRenderer;
use Chewie\Concerns\RegistersRenderers;

class Demo extends Prompt
{
    use RegistersRenderers;

    public function __construct()
    {
        $this->registerRenderer(DemoRenderer::class);
    }
}
```

You can also tell Chewie that all of your renderers live within a specific namespace, then Chewie will resolve your renderers automatically.

For example, if you call the following in your `AppServiceProvider`:

```
use Chewie\Renderer;

class AppServiceProvider
{
    public function boot()
    {
        Renderer::setNamespace('App\\Renderers');
    }
}
```

Then you can simply do the following when registering renderers. Chewie assumes your renderer class will be your app class + `Renderer`:

```
use Chewie\Concerns\RegistersRenderers;

class Demo extends Prompt
{
    use RegistersRenderers;

    public function __construct()
    {
        // Will register App\Renderers\DemoRenderer
        $this->registerRenderer();
    }
}
```

Drawing Art
-----------

[](#drawing-art)

You can easily print ASCII art from a file out to the terminal in your renderer:

```
use Chewie\Concerns\DrawsArt;

class DemoRenderer extends Renderer
{
    use DrawsArt;

    public function __invoke(Demo $prompt): string
    {
        // Returns a collection of the lines from your art,
        // assumes a ".txt" extension
        $this->artLines(storage_path('my-art/horse'))
            ->each($this->line(...));

        return $this;
    }
}
```

You can also tell Chewie where all of your art files live:

```
use Chewie\Art;

class AppServiceProvider
{
    public function boot()
    {
        Art::setDirectory(storage_path('my-art'));
    }
}
```

which allows you to simplify the `artLines` call to:

```
use Chewie\Concerns\DrawsArt;

class DemoRenderer extends Renderer
{
    use DrawsArt;

    public function __invoke(Demo $prompt): string
    {
        $this->artLines('horse')->each($this->line(...));

        return $this;
    }
}
```

Alignment
---------

[](#alignment)

Chewie comes with methods that help align content within the terminal.

```
use Chewie\Concerns\Aligns;

class DemoRenderer extends Renderer
{
    use Aligns;

    public function __invoke(Demo $prompt): string
    {
        $width = $prompt->terminal()->cols();
        $height = $prompt->terminal()->lines();

        $lines = [
            'Hello!',
            'My name is Joe',
        ];

        $this->centerHorizontally($lines, $width)
            ->each($this->line(...));

        $this->centerVertically($lines, $height)
            ->each($this->line(...));

        $this->center($lines, $width, $height)
            ->each($this->line(...));

        $this->line($this->spaceBetween($width, ...$lines));

        $this->pinToBottom($height, function() {
            $this->newLine();
            $this->line('This is pinned to the bottom!');
        });

        return $this;
    }
}
```

###  Health Score

34

—

LowBetter than 74% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity24

Early-stage or recently created project

 Bus Factor1

Top contributor holds 87.2% 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 ~4 days

Total

2

Last Release

0d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/735894a4f6e39aa85e3d136abc9cf0be92da593d88731382384185293cbfe965?d=identicon)[SRWieZ](/maintainers/SRWieZ)

---

Top Contributors

[![joetannenbaum](https://avatars.githubusercontent.com/u/2702148?v=4)](https://github.com/joetannenbaum "joetannenbaum (34 commits)")[![SRWieZ](https://avatars.githubusercontent.com/u/1408020?v=4)](https://github.com/SRWieZ "SRWieZ (4 commits)")[![danmatthews](https://avatars.githubusercontent.com/u/149426?v=4)](https://github.com/danmatthews "danmatthews (1 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/whatsdiff-chewie/health.svg)

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

###  Alternatives

[laravel/framework

The Laravel Framework.

34.9k556.2M21.1k](/packages/laravel-framework)[laravel/octane

Supercharge your Laravel application's performance.

4.0k28.5M253](/packages/laravel-octane)[statamic/cms

The Statamic CMS Core Package

4.9k3.8M1.1k](/packages/statamic-cms)[drush/drush

Drush is a command line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those of us who spend some of our working hours hacking away at the command prompt.

2.4k61.7M834](/packages/drush-drush)[laravel/boost

Laravel Boost accelerates AI-assisted development by providing the essential context and structure that AI needs to generate high-quality, Laravel-specific code.

3.6k26.0M754](/packages/laravel-boost)[laravel/ai

The official AI SDK for Laravel.

1.1k4.6M286](/packages/laravel-ai)

PHPackages © 2026

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