PHPackages                             locomotivemtl/charcoal-presenter - 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. [Templating &amp; Views](/categories/templating)
4. /
5. locomotivemtl/charcoal-presenter

ActiveLibrary[Templating &amp; Views](/categories/templating)

locomotivemtl/charcoal-presenter
================================

The missing charcoal layer between models and views.

0.3.2(6y ago)11.5k1MITPHPPHP &gt;=5.6.0 || &gt;=7.0CI failing

Since Jun 10Pushed 6y ago14 watchersCompare

[ Source](https://github.com/locomotivemtl/charcoal-presenter)[ Packagist](https://packagist.org/packages/locomotivemtl/charcoal-presenter)[ RSS](/packages/locomotivemtl-charcoal-presenter/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (4)Dependencies (3)Versions (6)Used By (0)

Charcoal Presenter
==================

[](#charcoal-presenter)

The missing layer between models and views. The Presenter takes any *data model* (objects or arrays) and serializes them into a presentation array according to a *transformer*.

Usage
=====

[](#usage)

Simplest usage, with a simple array transformer:

```
$presenter = new Presenter([
    'id',
    'name',
    'display_date'
]);

$model = $factory->create(Model::class);
$viewData = $presenter->transform($model);
```

A callable is preferred if operations on objects are required:

The callable signature must `array: callable(mixed $model)`.

```
$presenter = new Presenter(function($model) {
    return [
        'id',
        'name',
        'display_date' => $model->date->format('Y-m-d')
    ];
});

$model = $factory->create(Model::class);
$viewData = $presenter->transform($model);
```

Common transformers (or customizable transformers, shown below) should be self-contained inside their own `Callable` classes:

```
class MyTransformer
{
    /**
     * @var string $dateFormat
     */
    private $dateFormat;

    /**
     * @param string $dateFormat The date format.
     */
    public function __construct($dateFormat)
    {
        $this->dateFormat = $dateFormat;
    }

    /**
     * @param mixed $model The model to transform.
     * @return array
     */
    public function __invoke($model)
    {
        $displayDate = $obj->date->format($this->dateFormat);
        return [
            'id',
            'name',
            'display_date'=>$displayDate
        ];
    }
}

$presenter = new Presenter(new MyTransformer('Y-m-d'));

$model = $factory->create(Model::class);
$viewData = $presenter->transform($model);
```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 72.7% 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 ~370 days

Total

5

Last Release

2193d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cfb071c0ff7ce9500c528a003a2c53124248debc3e5bf367c17f89f5e6136125?d=identicon)[mducharme](/maintainers/mducharme)

---

Top Contributors

[![mducharme](https://avatars.githubusercontent.com/u/12157?v=4)](https://github.com/mducharme "mducharme (8 commits)")[![JoelAlphonso](https://avatars.githubusercontent.com/u/10762266?v=4)](https://github.com/JoelAlphonso "JoelAlphonso (2 commits)")[![veve40](https://avatars.githubusercontent.com/u/7537381?v=4)](https://github.com/veve40 "veve40 (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/locomotivemtl-charcoal-presenter/health.svg)

```
[![Health](https://phpackages.com/badges/locomotivemtl-charcoal-presenter/health.svg)](https://phpackages.com/packages/locomotivemtl-charcoal-presenter)
```

###  Alternatives

[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3851.2M](/packages/limenius-react-bundle)[area17/laravel-auto-head-tags

Laravel Auto Head Tags helps you build the list of head elements for your app

4616.1k](/packages/area17-laravel-auto-head-tags)[ktquez/laravel-tinymce

TinyMCE editor for Laravel and Lumen Framework

2525.4k](/packages/ktquez-laravel-tinymce)[jelix/wikirenderer

WikiRenderer is a library to generate HTML or anything else from wiki content.

1712.3k1](/packages/jelix-wikirenderer)[webkinder/sproutset

A Composer package for handling responsive images in Roots Bedrock + Sage + Blade projects.

282.2k](/packages/webkinder-sproutset)

PHPackages © 2026

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