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

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

joetannenbaum/chewie
====================

0.1.11(1y ago)122426.2k↓17.2%7[1 issues](https://github.com/joetannenbaum/chewie/issues)[2 PRs](https://github.com/joetannenbaum/chewie/pulls)9PHP

Since Mar 18Pushed 1y ago5 watchersCompare

[ Source](https://github.com/joetannenbaum/chewie)[ Packagist](https://packagist.org/packages/joetannenbaum/chewie)[ RSS](/packages/joetannenbaum-chewie/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (12)Used By (9)

[![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

41

—

FairBetter than 89% of packages

Maintenance41

Moderate activity, may be stable

Popularity53

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 97.1% 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 ~29 days

Recently: every ~14 days

Total

10

Last Release

528d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8cc9e697c220afa4ac18184d1aaab004e2da9448ac251a74e6031eec48b21601?d=identicon)[joetannenbaum](/maintainers/joetannenbaum)

---

Top Contributors

[![joetannenbaum](https://avatars.githubusercontent.com/u/2702148?v=4)](https://github.com/joetannenbaum "joetannenbaum (34 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/joetannenbaum-chewie/health.svg)

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

###  Alternatives

[livewire/flux

The official UI component library for Livewire.

9475.0M86](/packages/livewire-flux)[log1x/acf-composer

Create fields, blocks, option pages, and widgets using ACF Builder and Sage 10

493760.2k13](/packages/log1x-acf-composer)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[nativephp/mobile

NativePHP for Mobile

82724.0k43](/packages/nativephp-mobile)[cheesegrits/filament-google-maps

A Google Maps package for Filament PHP with field, column and widget

322533.2k1](/packages/cheesegrits-filament-google-maps)[qruto/laravel-wave

Painless Laravel Broadcasting with SSE.

87048.4k](/packages/qruto-laravel-wave)

PHPackages © 2026

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