承接 gizburdt/paint 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

gizburdt/paint

Composer 安装命令:

composer require gizburdt/paint

包简介

Manipulate, transform and present data with ease

README 文档

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

统计信息

  • 总下载量: 10
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固