承接 escapio/php-iterables 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

escapio/php-iterables

最新稳定版本:v2.2.2

Composer 安装命令:

composer require escapio/php-iterables

包简介

Utility functions for working with iterables

README 文档

README

Description

PHP-Iterables is a simple utility library for PHP to provide an easy and consistent way of using iterables, no matter which type of iterable you work on: arrays, iterators or generators.

Furthermore, it allows you to chain several iterator functions in a fluent, easier-to-read way.

Features

Check out more detailed examples in the examples file.

This library includes common functions like

$double_iterable = map($iterable_of_numbers, fn($number) => $number * 2);
$filtered_iterable = filter($iterable_of_numbers, fn($number) => $number < 5);
$iterable = function () {
    yield 1;
    yield 2;
}
toArray($iterable); // [1, 2]

The iterable-Builder allow you to combine these functions in a fluent syntax:

(new \Escapio\Iterables\Builder())
  ->from(['Alice', 'Bob', 'Chuck'])
  ->map(strtolower(...))
  ->filter(fn ($name) => $name !== 'chuck')
  ->loop(function ($name) {
    echo $name . PHP_EOL;
  });
  // "alice"
  // "bob"

Installation

Install with composer:

composer require escapio/php-iterables

Contributing

Feel free to create feature request or report bugs via GitHub.

If you like to contribute, make sure that all tests and code style rules are satisfied, otherwise the CI will fail.

Tests

Command for executing the PHPUnit tests:

composer test

Code-Style

This library uses PHP CS Fixer for code formatting. Run the formatter with:

composer code-style:fix

Also see the CODE_OF_CONDUCT.

Changelog

See CHANGELOG.md

The changelog is managed by the composer package marcocesarato/php-conventional-changelog. There are some convenient scripts in the composer.json file to update the CHANGELOG and tag the commit with the current version:

  • composer release:patch
  • composer release:minor
  • composer release:major

License

PHP-Iterables is made available under the MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-19