PHP code example of phariscope / event-store-doctrine

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

    

phariscope / event-store-doctrine example snippets


    // Assume env var is intiailized.
    // Example DATABASE_URL=mysql://root:pwd1234@mariadb:3306/ap-prod?serverVersion=mariadb-10.9.3&amp;charset=utf8mb4

    $store = new EventStoreDoctrine();
    $subscriber = new PersistDoctrineEventSubscriber($store);
    EventPublisher::instance()->subscribe($subscriber); // use your own EventPublisherFacade could be a good idea