0n3s3c/baselibrary

This package is abandoned and no longer maintained. The author suggests using the jjware/collections package instead.

Library for working with objects in 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

Library of PHP Classes

This is a work in progress. Contained within are a group of classes which represent a base object, collections, and anything else that I might come up with.

Installation

Install the latest version

$ composer require 0n3s3c/baselibrary

Basic Usage

<?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]