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

永不停更,若是以为好请留下一个star!
Github:https://github.com/VikinDev/v-collectphp

介绍:

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


vcollect

安装:

一、Clone

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

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

二、编译安装

在扩展目录内,执行数组

phpize
./configure
make && make install

三、修改ini

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

使用

建立集合

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

可用方法


^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^
map collapse avg has mx mi toJson toArray take pluck
where ......更多方法将后续更新

举例:where

快速过滤或筛选集合spa

$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-collectcode

相关文章
相关标签/搜索