Download the PHP package wwwision/dcb-eventstore without Composer

On this page you can find all versions of the php package wwwision/dcb-eventstore. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package dcb-eventstore

Dynamic Consistency Boundary Event Store

Interfaces and types for Event Stores implementing Dynamic Consistency Boundaries according to the specification.

To actually commit events, a corresponding adapter package is required!

Adapters

The following adapter implementations can be used with this package:

Adapter Storage/Engine Transport, SDK
ekvedaras/dcb-eventstore-illuminate SQLite, MySQL/MariaDB, PostgreSQL Laravel Database
wwwision/dcb-eventstore-doctrine SQLite, MySQL/MariaDB, PostgreSQL Doctrine DBAL
wwwision/dcb-eventstore-esdb EventSourcing Database (file based, proprietary) HTTP
wwwision/dcb-eventstore-umadb UmaDB (file based, open source) Rust FFI (via custom PHP Extension)
wwwision/dcb-eventstore-umadb-grpc UmaDB (file based, open source) gRPC (via official PHP Extension)

Feel free to contact me or extend this list via pull request if you wrote another adapter implementation

Usage

Install via composer:

Create Event Store instance

Instantiation of Event Stores depend on the corresponding adapter package. This package comes with an in-memory Event Store for testing, that can be created like so:

Read Events

The read() function allows to read events. To obtain a stream of all events in the Event Store, Query::all() can be used:

The result is an iterable stream of SequencedEvents, that contain the originally appended event, the position of that event in the stream and some metadata:

Filter events

Query::fromItems() can be used to filter events, by their type:

...by tags:

...or by a combination:

Multiple QueryItems can be specified to filter events that match any of the specified items:

[!NOTE] Tags within a single QueryItem are conjunctive (combined with AND) while individual QueryItems are disjunctive (combined with OR)

Read Options

An optional 2nd argument can be specified in order to define custom limits/orderings:

By default events are always ordered by their SequencePosition in ascending order i.e. FIFO. Sometimes it can be useful to order events in descending order, for example in order to provide cursor-based pagination:

This can also be used to load the last event(s) with a certain type or tag:

Write Events

The append() function allows to write events.

Unconditional writes

DCB is all about enforcing consistency when appending new events. But in some cases (e.g. when importing data or for testing purposes) it can be necessary to write events without enforcing any constraint. Therefor, the appendCondition parameter can be left out:

Multiple events can be written atomically using Events:

Append Condition

The following call appends a ProductDefined event, but fails if a corresponding event for the same product id was appended previously (or practically at the same time, i.e. this operation ensures transaction safety):

In the previous example, no event in the entire stream must match the specified query – it can be compared with a NoStream expectation of a traditional event store. But DCB also supports to specify a "safe point" using the optional after parameter of the AppendCondition:

Higher Level API

This package mainly implements the low-level DCB specification (see dcb.events website). It's highly advised to introduce a higher level abstraction for the usage within the actual application logic.

Feel free to get in touch to see how this can be combined with the idea of composed projections in practice!

Contribution

Contributions in the form of issues, pull requests or discussions are highly appreciated

License

See LICENSE


All versions of dcb-eventstore with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
psr/clock Version ^1
webmozart/assert Version ^1.11.0 || ^2.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wwwision/dcb-eventstore contains the following files

Loading the files please wait ...