ramsey/array_column
最新稳定版本:1.1.3
Composer 安装命令:
composer require ramsey/array_column
包简介
Provides functionality for array_column() to projects using PHP earlier than version 5.5.
关键字:
README 文档
README
This simple library provides functionality for array_column()
to versions of PHP earlier than 5.5. It mimics the functionality of the built-in
function in every way.
Usage
array array_column(array $input, mixed $columnKey[, mixed $indexKey])
Given a multi-dimensional array of data, array_column() returns the values
from a single column of the input array, identified by the $columnKey.
Optionally, you may provide an $indexKey to index the values in the returned
array by the values from the $indexKey column in the input array.
For example, using the following array of data, we tell array_column() to
return an array of just the last names, indexed by their record IDs.
<?php $records = array( array( 'id' => 2135, 'first_name' => 'John', 'last_name' => 'Doe' ), array( 'id' => 3245, 'first_name' => 'Sally', 'last_name' => 'Smith' ), array( 'id' => 5342, 'first_name' => 'Jane', 'last_name' => 'Jones' ), array( 'id' => 5623, 'first_name' => 'Peter', 'last_name' => 'Doe' ) ); $lastNames = array_column($records, 'last_name', 'id');
If we call print_r() on $lastNames, you'll see a resulting array that looks
a bit like this:
Array
(
[2135] => Doe
[3245] => Smith
[5342] => Jones
[5623] => Doe
)
Installation
The easiest way to install this library is to use Composer:
php composer.phar require ramsey/array_column
Then, when you run composer install, everything will fall magically into place,
and the array_column() function will be available to your project, as long as
you are including Composer's autoloader.
However, you do not need Composer to use this library.
This library has no dependencies and should work on older versions of PHP.
Download the code and include src/array_column.php in your project, and all
should work fine.
When you are ready to run your project on PHP 5.5, everything should continue to run well without conflicts, even if this library remains included in your project.
ramsey/array_column 适用场景与选型建议
ramsey/array_column 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.48M 次下载、GitHub Stars 达 378, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「array」 「column」 「array_column」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ramsey/array_column 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ramsey/array_column 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ramsey/array_column 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A set of useful PHP classes.
Replacement for ramsey's array_column package: array_column() for projects using PHP earlier than version 5.5.
Display multiple images as a stack in your Filament tables
Trait providing methods to set class properties with an array.
This package provides the object_column() function, which works similarly to the array_column() function of the standard library, but having the ability to work with objects
Traits to build collections of specific objects
统计信息
- 总下载量: 3.48M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 380
- 点击次数: 21
- 依赖项目数: 35
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-04