PHP code example of biig / domain

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

    

biig / domain example snippets


class YourModel extends DomainModel
{
    public const CREATION = 'creation';
    public function __construct()
    {
        $this->dispatch(new DomainEvent($this), self::CREATION);
    }
}

class DomainRule implements DomainRuleInterface
{
    public function on()
    {
        return YourModel::CREATION;
    }
    
    public function execute(DomainEvent $event)
    {
        // Do Something on your model creation
    }
}


// config/bundles.php

return [
    // ...
    Biig\Component\Domain\Integration\Symfony\DomainBundle::class => ['all' => true],
];