PHP code example of blacksmith-project / event-manager

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

    

blacksmith-project / event-manager example snippets


class Entity implements IRegisterEvent
{
	use EventRegistration;

	private $id;
	
	private function __construct(UuidInterface $id)
	{
		$this->id = $id;
	}
	
	public static method Register(UuidInterface $id): self
	{
		$entity = new self($id);
		
		$this->recordedEvents[] = new EntityRegistered($id);
		
		return $entity;
	}
}