0n3s3c/baselibrary

此包已被放弃且不再维护。作者建议使用jjware/collections包代替。

用于操作PHP对象的库

0.5.1 2016-03-28 12:57 UTC

This package is not auto-updated.

Last update: 2016-10-06 16:24:56 UTC


README

Build Status

PHP类库

这是一个正在进行中的项目。其中包含了一组代表基础对象、集合以及其他可能想出的任何东西的类。

安装

安装最新版本

$ composer require 0n3s3c/baselibrary

基本用法

<?php

use Base\Collections\Collection;
use Base\Collections\AddItemEventArgs;

$collection = new Collection();

$collection->on("add", function (Collection $sender, AddItemEventArgs $eventArgs) {
  echo $eventArgs->getItem();
});

$collection->add(1);
$collection->add(2);
$collection->add(3);

$lessThanThree = $collection->where(function ($x) {
  return $x < 3;
});

//lessThanThree == [1, 2]