PHP code example of lendable / aggregate

1. Go to this page and download the library: Download lendable/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/ */

    

lendable / aggregate example snippets


use Lendable\Aggregate\Testing\AggregateIdExtractorSpec;
use Lendable\Aggregate\AggregateIdExtractor;
use Lendable\Aggregate\AggregateId;

final class FooIdExtractor extends AggregateIdExtractorSpec 
{
    protected function createExtractor(): AggregateIdExtractor
    {
        return new FooIdExtractor();
    }
    
    protected function createExpectedAggregateId(): AggregateId
    {
        return AggregateId::fromString('1406fd13-29d3-44e3-812c-c1cd14e12b38');
    }
    
    protected function createAggregateWithExpectedAggregateId(): object
    {
        return Foo::register(FooId::fromString('1406fd13-29d3-44e3-812c-c1cd14e12b38'));
    }
}