1. Go to this page and download the library: Download phpgears/aggregate 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/ */
phpgears / aggregate example snippets
use Gears\Aggregate\AbstractAggregateRoot;
use Gears\Identity\Identity;
class CustomAggregate extends AbstractAggregateRoot
{
public static function instantiate(Identity $identity): self
{
return new self($identity);
}
}
use Gears\Aggregate\AbstractAggregateRoot;
use Gears\Identity\Identity;
class CustomAggregate extends AbstractAggregateRoot
{
public static function instantiate(Identity $identity): self
{
return new self($identity);
}
public function doSomething(): void
{
// do something
$this->recordEvent(new SomethingHappened());
}
}