gizburdt/paint

Manipulate, transform and present data with ease

Maintainers

👁 gizburdt

Package info

github.com/gizburdt/paint

pkg:composer/gizburdt/paint

Statistics

Installs: 10

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

1.0.0 2026-05-31 11:31 UTC

Requires

  • php: ^8.2

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT b0b57ff9009f6528b46ec7ab24808e557b8f7164

laravelpresenter

This package is auto-updated.

Last update: 2026-05-31 11:35:50 UTC


README

👁 Latest Version on Packagist
👁 Total Downloads
👁 Tests
👁 Software License

Manipulate, transform and present data with ease.

Installation

You can install the package via composer:

composer require gizburdt/paint

Usage

Create a presenter by extending Presenter and adding methods. The original object is available as $this->entity.

use Gizburdt\Paint\Presenter;

class UserPresenter extends Presenter
{
 public function fullName(): string
 {
 return "{$this->entity->first_name}{$this->entity->last_name}";
 }

 public function name(): string
 {
 return strtoupper($this->entity->first_name);
 }
}

Add the Presentable trait to the class you want to present and point the $presenter property to your presenter:

use Gizburdt\Paint\Presentable;

class User
{
 use Presentable;

 protected string $presenter = UserPresenter::class;
}

Call present() to get the presenter instance. Methods can be accessed as properties, and any property that is not defined on the presenter falls back to the entity:

$user = User::find(1);

$user->present()->fullName(); // "John Doe" (regular method call)
$user->present()->name; // "JOHN" (name() accessed as a property)
$user->present()->email; // falls back to $user->email

Testing

composer test