cyril-verloop/iterator
Composer 安装命令:
composer require cyril-verloop/iterator
包简介
An iterator utility.
README 文档
README
A simple PHP iterator abstract class requiring PHP 8.0+.
Installation
As a Composer depedency
In your project directory run
user@host project$ composer require "cyril-verloop/iterator"
For development purposes
user@host ~$ cd [PATH_WHERE_TO_PUT_THE_PROJECT] # E.g. ~/projects/ user@host projects$ git clone https://github.com/cyrilverloop/iterator.git user@host projects$ cd iterator user@host iterator$ composer install -o user@host datatables$ phive install --trust-gpg-keys 4AA394086372C20A,99BF4D9A33D65E1E,31C7E470E2138192,8AC0BAA79732DD42,C5095986493B4AA0
Usage
You need to extend the abstract class and you can add parameter and return types.
<?php declare(strict_types=1); namespace MyNamespace; use MyNamespace\Item; class Items extends IntPosition { public function add(Item $item): void { $this->list[count($this->list)] = $item; } public function current(): Item { return parent::current(); } }
Then, you can use it in a foreach loop :
$items->add($item1); $items->add($item2); foreach($items as $item) { // Do something. }
Continuous integration
Tests
To run the tests :
user@host iterator$ ./tools/phpunit -c ./ci/phpunit.xml
The generated outputs will be in ./ci/phpunit/.
Look at ./ci/phpunit/html/index.html for code coverage
and ./ci/phpunit/testdox.html for a verbose list of passing / failing tests.
To run mutation testing, you must run PHPUnit first, then :
user@host doctrine-entities$ ./tools/infection -c./ci/infection.json
The generated outputs will be in ./ci/infection/.
Static analysis
To do a static analysis :
user@host iterator$ ./tools/psalm -c ./ci/psalm.xml [--report=./psalm/psalm.txt --output-format=text]
Use "--report=./psalm/psalm.txt --output-format=text" if you want the output in a file instead of on screen.
PHPDoc
To generate the PHPDoc :
user@host iterator$ ./tools/phpdocumentor --config ./ci/phpdoc.xml
The generated HTML documentation will be in ./ci/phpdoc/.
Standard
All PHP files in this project follows PSR-12. To indent the code :
user@host doctrine-entities$ ./tools/phpcbf --standard=PSR12 --extensions=php -p ./src/ ./tests/
cyril-verloop/iterator 适用场景与选型建议
cyril-verloop/iterator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 713 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 11 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 cyril-verloop/iterator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cyril-verloop/iterator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 713
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-11-04