level51/cqrs-utils

Multi-Datastore CQRS utilities for SilverStripe

Maintainers

👁 JZubero

Package info

github.com/Level51/cqrs-utils

Type:silverstripe-module

pkg:composer/level51/cqrs-utils

Statistics

Installs: 398

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 2

dev-develop 2017-11-08 00:00 UTC

Requires

Requires (Dev)

None

Suggests

Provides

None

Conflicts

None

Replaces

None

MIT 0a902b3df70607431778d22841edf49371a42c9d

  • Julian Scheuchenzuber <js.woop@lvl51.de>

This package is auto-updated.

Last update: 2026-06-22 16:53:22 UTC


README

Utility Module for implementing the CQRS workflow within a SilverStripe application.

⚠️ This is work in progress and not ready to use/play around with at all! We are just testing this in a project and will deliver a stable build as soon as we have reached a sufficient amount of added value.

Read Payload Manifests

Read Payload Manifests defines the data to be stored on a class basis.

Example Manifest ($read_payload):

class MyObject extends DataObject {

 private static $db = [
 'Title' => 'Varchar',
 'Teaser => 'Text',
 'Content => 'HTMLText'
 ];
 
 private static $has_many = [
 'Categories' => Category::class
 ];
 
 private static $read_payload = [
 'ID', // required
 'Title' => 'CoolTitle' // required, maps to "CoolTitle()"
 'Teaser' => false, // not required
 'Content' => true, // required (non-shorthand)
 'Author', // required (method value)
 'Categories' => true, // required recursive relation table
 'Tags' => [ // not required, maps to "getMyTags()"
 'required' => false,
 'mapping' => 'getMyTags'
 ]
 ];
 
 public function CoolTitle() { ... }
 
 public function Author() { ... }
 
 public function getMyTags() { ... }
}

Handler

Redis

Additional Requirements

  • ext-redis: PHP Redis extension

Example Config

CustomDataObject:
 extensions:
 - CQRSExtension('ID', ['store' => 'RedisPayloadStoreHandler', 'db' => 1])

# Optional, defaults to the values below
RedisPayloadStoreHandler:
 host: 127.0.0.1
 port: 6379
 default_db: 0	

MongoDB

Additional Requirements

Example Config

CustomDataObject:
 extensions:
 - CQRSExtension('ID', ['store' => 'MongoPayloadStoreHandler', 'db' => 'DB_NAME', 'collection' => 'COLLECTION_NAME'])

# Optional, defaults to the values below
MongoPayloadStoreHandler:
 host: 127.0.0.1
 port: 27017	

Elasticsearch

Additional Requirements

Example Config

CustomDataObject:
 extensions:
 - CQRSExtension('ID', ['store' => 'ElasticsearchPayloadStoreHandler', 'index' => 'INDEX_NAME'])

# Optional, defaults to localhost:9200
ElasticsearchPayloadStoreHandler:
 hosts:
 - localhost:9200
 - { host: elastic.domain.tld, port: 443, scheme: https, user: USERNAME, pass: PASS }

Maintainer