承接 componenta/arrayable 相关项目开发

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

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

componenta/arrayable

Composer 安装命令:

composer require componenta/arrayable

包简介

Array conversion contract for Componenta packages

README 文档

README

Minimal contract for objects that expose a public array representation.

Use it when a package needs to accept DTOs, view models, pagination results, or collections without depending on a serializer implementation.

Installation

composer require componenta/arrayable

Related Packages

Package Why it matters here
componenta/array to_array() consumes Arrayable objects.
componenta/http-responder Responders can turn arrayable objects into JSON responses.
componenta/paginator Pagination results can expose a public array shape.

Usage

use Componenta\Arrayable\Arrayable;

final readonly class UserView implements Arrayable
{
    public function __construct(
        public string $id,
        public string $name,
    ) {}

    public function toArray(): array
    {
        return [
            'id' => $this->id,
            'name' => $this->name,
        ];
    }
}

Contract

Arrayable::toArray() returns the public array representation of an object.

The interface does not define:

  • JSON encoding
  • recursive conversion rules
  • key naming conventions
  • whether private/internal state is included

Those decisions belong to the implementing object or to a serializer package.

Typical Consumers

Packages such as paginator, iterator helpers, HTTP responders, and config exporters can depend on this contract when they only need an array shape and do not need object-specific behavior.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固