ialopezg/collections
Composer 安装命令:
composer require ialopezg/collections
包简介
PHP Base Library for Collection Management
README 文档
README
PHP based Collections Manager
Installation
composer require ialopezg/collections
Requirements
- PHP 5.6+
Features
- Set item
- Update item
- Remove item
- Lookup for an item
- By key name when single lookup
- By dot notation when nested lookup
- Data cache for quick access
- Access to firs level object by invoking its name in the class, by example:
echo $collection->itemName;. Protected properties cannot be invoked. - Merging of classes are derivative from
CollectionInterface. - Access to its items like associative arrays.
Usage
use ialopezg\Libraries\Collection; // class derived from Collection class class ItemCollection extends Collection { } $collection = new ItemCollection([]); // get the value, if not found return default value echo $collection->get('item_name', 'initial value'); // changing item_name's value $collection->set('item_name', 'item value'); // print current value if ($collection->has('item_name')) { echo $collection->get('item_name'); } // remove item_name property $collection->remove('item_name'); echo $collection->count();
Please, check examples directory for more details of usage or run:
### from linux bash
./server.sh
or
### from windows bash
server.bat
License
This project is under the MIT license. For more information see LICENSE.
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-09-15