vcollect PHP Extension 让你优雅的处理集合!

永不停更,如果觉得好请留下一个star!
Github:https://github.com/VikinDev/v-collect

介绍:

vcollect 是一个PHP C Extension,提供流畅、便利的数组数据操作。

《vcollect PHP Extension 让你优雅的处理集合!》

安装:

1、Clone

定位于PHP下的ext目录,执行

git clone https://github.com/VikinDev/v-collect.git

2、编译安装

在扩展目录内,执行

phpize
./configure
make && make install

3、修改ini

在php.ini文件中加入extension = vcollect.so

使用

创建集合

$test = vcollect([1, 2, 3, 4, 5, 6]);

可用方法

^_^^_^^_^^_^^_^^_^^_^^_^^_^^_^
mapcollapseavghasmxmitoJsontoArraytakepluck
where……更多方法将后续更新

举例:where

快速过滤或筛选集合

$vcollect = vcollect([
    ['developer' => ['name' => 'Taylor', 'option' => ['test' => 'one'] ] ],
    ['developer' => ['name' => 'Abigail', 'option' => ['test' => 'two'] ] ]
]);

$vcollect->where('developer.option.test', 'one')->toArray();

// ['developer' => ['name' => 'Taylor', 'option' => ['test' => 'one'] ] ]

永不停更,如果觉得好请留下一个star!
Github:https://github.com/VikinDev/v-collect

    原文作者:凌云
    原文地址: https://segmentfault.com/a/1190000007963399
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞