amitmerchant/array-utils 问题修复 & 功能扩展

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

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

amitmerchant/array-utils

Composer 安装命令:

composer require amitmerchant/array-utils

包简介

Simple wrapper implementation of common PHP array methods

README 文档

README

This is a wrapper class implementation which I've described in this article.

Installation

You can install the package via composer:

$ composer require amitmerchant/array-utils

Usage

<?php

use Amitmerchant\ArrayUtils\ArrayUtils;

// Map Array → wrapper for [array_map](https://www.php.net/manual/en/function.array-map.php)

$mappedArray = ArrayUtils::getInstance()
                    ->collect([1, 2, 3, 4])
                    ->map(function($iteration) {
                        return $iteration * 2;
                    });

print_r($mappedArray);
/*
Array
(
    [0] => 2
    [1] => 4
    [2] => 6
    [3] => 8
)
*/

// Filter Array → wrapper for [array_filter](https://www.php.net/manual/en/function.array-filter.php)

$filterArray = ArrayUtils::getInstance()
                    ->collect([1, 2, 3, 4, 5])
                    ->filter(function($iteration) {
                        return ($iteration & 1);
                    });

/*
Array
(
    [0] => 1
    [1] => 3
    [2] => 5
)
*/

For more examples, check tests.

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email bullredeyes@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-05-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固