yellowcable/collection
最新稳定版本:2.0.0
Composer 安装命令:
composer require yellowcable/collection
包简介
Collection and Aggregation.
README 文档
README
Collection and Aggregation library for PHP8.2+
Create object collections and be in control of iteration and access.
- You can either extend the abstract or implement and use the interfaces and traits.
- Aggregation is simple; it clears the content of the collections!
Usage
To use a Collection, make sure you create or instantiate:
$collection = new ItemCollection("test", [
new Item("1", 1, 1),
new Item("1", 1, 1),
new Item("1", 1, 1),
new Item("1", 1, 1),
]);
-----------------------------------------------
$collection = new class () extends Collection
{
public function getClass(): string
{
return Item::class;
}
};
Aggregations are possible in the same fashion as Collections:
$agg = new ItemAggregation("bliep");
$agg->addCollection(new ItemCollection("test", [new Item("item", 1, 1)]), false);
Notes
- Don't use stdClass if you want to serialize; PHP will not allow it.
Contribute
Contributions are always welcome! Suggestions are only welcome in the form of code.
License
To the extent possible under law, Yellow Cable has waived all copyright and related or neighboring rights to this work.
统计信息
- 总下载量: 1.07k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: CC0-1.0
- 更新时间: 2023-07-28