PHP code example of harbor / collections
1. Go to this page and download the library: Download harbor/collections library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
harbor / collections example snippets
php
class Foo implements CollectionInterface, ArrayAccess, Countable, IteratorAggregate, JsonSerializable
{
use Harbor\Collections\CollectionTrait;
}
// Use it
$foo = new Foo();
$foo->bar = 'bar';
php
use Harbor\Collections\CollectionInterface;
class Foo
{
protected $data;
public function __construct(CollectionInterface $data)
{
$this->data = $data;
}
}
// Use it
$foo = new Foo(new Collection());