1. Go to this page and download the library: Download goksagun/collection 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/ */
goksagun / collection example snippets
namespace Acme;
class Product
{
public function __construct (
private string $name,
private float $price
) {}
public function getName(): string
{
return $this->name;
}
public function getPrice(): float
{
return $this->price;
}
}
namespace Acme;
use Acme\Product;
use Goksagun\Collection\Collection;
/**
* @implements Collection<Product>
*/
final class ProductCollection extends Collection
{
public function __construct(Product ...$items)
{
parent::__construct(...$items);
}
}