2017 © Pedro Peláez
 

library collections

Gephart Collections Component

image

gephart/collections

Gephart Collections Component

  • Monday, October 2, 2017
  • by MichalKatuscak
  • Repository
  • 1 Watchers
  • 0 Stars
  • 99 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 15 % Grown

The README.md

Gephart Collections

php, (*1)

Dependencies

  • PHP >= 7.4

Instalation

composer require gephart/collections dev-master

Using

Collection without a specific type

$collection = new Gephart\Collections\Collection();

$collection->add("Something"); // Index - 0
$collection->add(123); // Index - 1

$item = $collection->get(1); // 123

$collection->remove(1); // Delete item with index 1

$items = $collection->all(); // [0 => "Something"];

Collection with a specific type

class SpecificEntity { public $text = ""; }

$item1 = new SpecificEntity();
$item1->text = "first";

$item2 = new SpecificEntity();
$item2->text = "second";

$collection = new Gephart\Collections\Collection(SpecificEntity::class);

$collection->add($item1);
$collection->add($item2);
// Or use method collect(): $collection->collect([$item1, $item2]);

$item = $collection->get(1);
echo $item->text; // "second"

The Versions

02/10 2017

dev-master

9999999-dev https://github.com/gephart/collections

Gephart Collections Component

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

02/10 2017

0.5

0.5.0.0 https://github.com/gephart/collections

Gephart Collections Component

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires