xiaoliuit/toolkit 问题修复 & 功能扩展

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

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

xiaoliuit/toolkit

Composer 安装命令:

composer require xiaoliuit/toolkit

包简介

A toolkit for convenient array operations in PHP

README 文档

README

A simple PHP library for convenient array operations.

Installation

You can install the package via composer:

composer require GameTookit/array-toolkit

## Usage
```php
<?php
use YourNamespace\ArrayToolkit;

$array = ['name' => 'John', 'age' => 30, 'city' => 'New York'];

// Pluck specific keys
$result = ArrayToolkit::pluck($array, ['name', 'age']);
// Result: ['name' => 'John', 'age' => 30]

// Remove specific keys
$result = ArrayToolkit::except($array, ['age']);
// Result: ['name' => 'John', 'city' => 'New York']

// Flatten a multi-dimensional array
$nestedArray = [1, [2, 3], [4, [5, 6]]];
$result = ArrayToolkit::flatten($nestedArray);
// Result: [1, 2, 3, 4, 5, 6]

// Group an array of arrays by a specific key
$users = [
    ['name' => 'John', 'role' => 'admin'],
    ['name' => 'Jane', 'role' => 'user'],
    ['name' => 'Bob', 'role' => 'admin']
];
$result = ArrayToolkit::groupBy($users, 'role');
// Result: [
//     'admin' => [
//         ['name' => 'John', 'role' => 'admin'],
//         ['name' => 'Bob', 'role' => 'admin']
//     ],
//     'user' => [
//         ['name' => 'Jane', 'role' => 'user']
//     ]
// ]

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: proprietary
  • 更新时间: 2024-08-03