componenta/array 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

componenta/array

Composer 安装命令:

composer require componenta/array

包简介

Array helper functions for Componenta packages

README 文档

README

Standalone array helper functions for key checks, nested paths, filtering, mapping, sorting, grouping, recursive transforms, query-string building, and conversion to plain arrays.

Use this package when a library needs predictable array utilities without pulling in a larger collection component.

Installation

composer require componenta/array

Related Packages

Package Why it matters here
componenta/arrayable to_array() consumes ArrayableInterface when an object exposes an array representation.
componenta/config Often works with nested arrays and paths, while configuration access itself stays in componenta/config.

Usage

use function Componenta\Array\array_get;
use function Componenta\Array\array_path;
use function Componenta\Array\array_set_path;

$data = ['user' => ['name' => 'Ada']];

$name = array_path($data, 'user.name');       // "Ada"
$missing = array_get($data, 'email', 'none'); // "none"

array_set_path($data, 'user.email', 'ada@example.com');

Helper Groups

Lookup helpers:

  • array_has
  • array_has_any
  • array_has_all
  • array_missing
  • array_get
  • array_get_typed
  • array_get_or_fail
  • array_path
  • array_path_or_fail

Mutation helpers:

  • array_put
  • array_add
  • array_set
  • array_set_path
  • array_forget
  • array_forget_path
  • array_pull

Selection and transformation:

  • array_only
  • array_except
  • array_where
  • array_map_with_keys
  • array_map_recursive
  • array_filter_null
  • array_pluck
  • array_group_by
  • array_key_by
  • array_partition

Structure helpers:

  • array_flatten
  • array_collapse
  • array_dot
  • array_undot
  • array_divide
  • array_wrap
  • array_chunk_by

Ordering and set-like helpers:

  • array_sort
  • array_sort_recursive
  • array_shuffle
  • array_random
  • array_unique_by
  • array_diff_assoc_recursive
  • array_merge_recursive_distinct

Predicate helpers:

  • array_contains
  • array_first
  • array_last
  • array_find_key
  • array_every
  • array_some
  • array_exists
  • array_is_assoc
  • is_accessible

Other helpers:

  • array_join
  • array_take
  • array_skip
  • array_query
  • to_array

Conversion

to_array() understands arrays, objects, iterators, iterator aggregates, and Componenta\Arrayable\Arrayable.

The package does not define serialization policy for domain objects. If an object has application-specific output rules, expose them through Arrayable or a serializer layer.

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固