├── Dockerfile
├── LICENSE
├── Makefile
├── README.md
├── UPGRADE-2.0.md
├── UPGRADE-3.0.md
├── baseline.xml
├── composer.json
├── deptrac-baseline.yaml
├── deptrac.yaml
├── docker-compose.yaml
├── infection.json.dist
├── phpstan-baseline.neon
├── phpstan.neon.dist
├── psalm_docs.xml
├── renovate.json
└── src
├── Aggregate
├── AggregateException.php
├── AggregateHeader.php
├── AggregateRoot.php
├── AggregateRootAttributeBehaviour.php
├── AggregateRootBehaviour.php
├── AggregateRootId.php
├── AggregateRootIdNotSupported.php
├── AggregateRootMetadataAware.php
├── AggregateRootMetadataAwareBehaviour.php
├── ApplyMethodNotFound.php
├── BasicAggregateRoot.php
├── BasicChildAggregate.php
├── ChildAggregate.php
├── ChildAggregateBehaviour.php
├── CustomId.php
├── CustomIdBehaviour.php
├── InvalidAggregateStreamName.php
├── MetadataNotPossible.php
├── RamseyUuidV7Behaviour.php
└── Uuid.php
├── Attribute
├── Aggregate.php
├── Answer.php
├── Apply.php
├── ChildAggregate.php
├── Event.php
├── Handle.php
├── Header.php
├── Id.php
├── Inject.php
├── OnFailed.php
├── Processor.php
├── Projector.php
├── RetryAggregateOutdated.php
├── RetryStrategy.php
├── Setup.php
├── Snapshot.php
├── SplitStream.php
├── Stream.php
├── Subscribe.php
├── Subscriber.php
├── SuppressMissingApply.php
└── Teardown.php
├── Clock
├── FrozenClock.php
└── SystemClock.php
├── CommandBus
├── AggregateHandlerProvider.php
├── ChainHandlerProvider.php
├── CommandBus.php
├── Handler
│ ├── AggregateIdNotFound.php
│ ├── CreateAggregateHandler.php
│ ├── DefaultParameterResolver.php
│ ├── ParameterResolver.php
│ ├── ServiceNotResolvable.php
│ └── UpdateAggregateHandler.php
├── HandlerDescriptor.php
├── HandlerFinder.php
├── HandlerNotFound.php
├── HandlerProvider.php
├── HandlerReference.php
├── InvalidHandleMethod.php
├── MultipleHandlersFound.php
├── RetryOutdatedAggregateCommandBus.php
├── ServiceHandlerProvider.php
├── ServiceLocator.php
├── ServiceNotFound.php
└── SyncCommandBus.php
├── Console
├── Command
│ ├── DatabaseCreateCommand.php
│ ├── DatabaseDropCommand.php
│ ├── DebugCommand.php
│ ├── SchemaCreateCommand.php
│ ├── SchemaDropCommand.php
│ ├── SchemaUpdateCommand.php
│ ├── ShowAggregateCommand.php
│ ├── ShowCommand.php
│ ├── SubscriptionBootCommand.php
│ ├── SubscriptionCommand.php
│ ├── SubscriptionPauseCommand.php
│ ├── SubscriptionReactivateCommand.php
│ ├── SubscriptionRemoveCommand.php
│ ├── SubscriptionRunCommand.php
│ ├── SubscriptionSetupCommand.php
│ ├── SubscriptionStatusCommand.php
│ ├── SubscriptionTeardownCommand.php
│ └── WatchCommand.php
├── DoctrineHelper.php
├── InputHelper.php
├── InvalidArgumentGiven.php
└── OutputStyle.php
├── Cryptography
└── DoctrineCipherKeyStore.php
├── EventBus
├── AttributeListenerProvider.php
├── Consumer.php
├── DefaultConsumer.php
├── DefaultEventBus.php
├── EventBus.php
├── ListenerDescriptor.php
├── ListenerProvider.php
└── Psr14EventBus.php
├── Message
├── HeaderNotFound.php
├── Message.php
├── Pipe.php
├── Reducer.php
├── Serializer
│ ├── DefaultHeadersSerializer.php
│ ├── HeadersSerializer.php
│ └── InvalidArgument.php
└── Translator
│ ├── AggregateToStreamHeaderTranslator.php
│ ├── ChainTranslator.php
│ ├── ClosureMiddleware.php
│ ├── ExcludeEventTranslator.php
│ ├── ExcludeEventWithHeaderTranslator.php
│ ├── FilterEventTranslator.php
│ ├── IncludeEventTranslator.php
│ ├── IncludeEventWithHeaderTranslator.php
│ ├── RecalculatePlayheadTranslator.php
│ ├── ReplaceEventTranslator.php
│ ├── Translator.php
│ └── UntilEventTranslator.php
├── Metadata
├── AggregateRoot
│ ├── AggregateRootAlreadyInRegistry.php
│ ├── AggregateRootClassNotRegistered.php
│ ├── AggregateRootIdNotFound.php
│ ├── AggregateRootMetadata.php
│ ├── AggregateRootMetadataAwareMetadataFactory.php
│ ├── AggregateRootMetadataFactory.php
│ ├── AggregateRootNameNotRegistered.php
│ ├── AggregateRootRegistry.php
│ ├── AggregateRootRegistryFactory.php
│ ├── AggregateWithoutMetadataAware.php
│ ├── ArgumentTypeIsMissing.php
│ ├── ArgumentTypeIsNotAClass.php
│ ├── AttributeAggregateRootMetadataFactory.php
│ ├── AttributeAggregateRootRegistryFactory.php
│ ├── ClassIsNotAnAggregate.php
│ ├── DuplicateApplyMethod.php
│ ├── DuplicateEmptyApplyAttribute.php
│ ├── MissingAggregateIdForStreamName.php
│ ├── MissingDataSubjectId.php
│ ├── MixedApplyAttributeUsage.php
│ ├── MultipleDataSubjectId.php
│ ├── NoAggregateRoot.php
│ ├── Psr16AggregateRootMetadataFactory.php
│ ├── Psr16AggregateRootRegistryFactory.php
│ ├── Psr6AggregateRootMetadataFactory.php
│ ├── Psr6AggregateRootRegistryFactory.php
│ ├── Snapshot.php
│ └── SubjectIdAndPersonalDataConflict.php
├── ClassFinder.php
├── Event
│ ├── AttributeEventMetadataFactory.php
│ ├── AttributeEventRegistryFactory.php
│ ├── ClassIsNotAnEvent.php
│ ├── EventAlreadyInRegistry.php
│ ├── EventClassNotRegistered.php
│ ├── EventMetadata.php
│ ├── EventMetadataFactory.php
│ ├── EventNameNotRegistered.php
│ ├── EventRegistry.php
│ ├── EventRegistryFactory.php
│ ├── MissingDataSubjectId.php
│ ├── MultipleDataSubjectId.php
│ ├── Psr16EventMetadataFactory.php
│ ├── Psr16EventRegistryFactory.php
│ ├── Psr6EventMetadataFactory.php
│ ├── Psr6EventRegistryFactory.php
│ └── SubjectIdAndPersonalDataConflict.php
├── Message
│ ├── AttributeMessageHeaderRegistryFactory.php
│ ├── HeaderClassNotRegistered.php
│ ├── HeaderNameNotRegistered.php
│ ├── MessageHeaderRegistry.php
│ └── MessageHeaderRegistryFactory.php
├── MetadataException.php
└── Subscriber
│ ├── ArgumentMetadata.php
│ ├── ArgumentTypeNotSupported.php
│ ├── AttributeSubscriberMetadataFactory.php
│ ├── ClassIsNotASubscriber.php
│ ├── DuplicateFailedMethod.php
│ ├── DuplicateSetupMethod.php
│ ├── DuplicateSubscribeMethod.php
│ ├── DuplicateTeardownMethod.php
│ ├── Psr16SubscriberMetadataFactory.php
│ ├── Psr6SubscriberMetadataFactory.php
│ ├── SubscribeMethodMetadata.php
│ ├── SubscriberMetadata.php
│ └── SubscriberMetadataFactory.php
├── QueryBus
├── ChainHandlerProvider.php
├── HandlerDescriptor.php
├── HandlerFinder.php
├── HandlerProvider.php
├── HandlerReference.php
├── InvalidHandleMethod.php
├── InvalidQueryHandler.php
├── QueryBus.php
├── ServiceHandlerProvider.php
└── SyncQueryBus.php
├── Repository
├── AggregateAlreadyExists.php
├── AggregateDetached.php
├── AggregateNotFound.php
├── AggregateOutdated.php
├── AggregateUnknown.php
├── DefaultRepository.php
├── DefaultRepositoryManager.php
├── MessageDecorator
│ ├── ChainMessageDecorator.php
│ ├── MessageDecorator.php
│ └── SplitStreamDecorator.php
├── PlayheadMismatch.php
├── Repository.php
├── RepositoryException.php
├── RepositoryManager.php
├── SnapshotRebuildFailed.php
└── WrongAggregate.php
├── Schema
├── ChainDoctrineSchemaConfigurator.php
├── DoctrineMigrationSchemaProvider.php
├── DoctrineSchemaConfigurator.php
├── DoctrineSchemaDirector.php
├── DoctrineSchemaListener.php
├── DoctrineSchemaProvider.php
├── DoctrineSchemaSubscriber.php
├── DryRunSchemaDirector.php
└── SchemaDirector.php
├── Serializer
├── DefaultEventSerializer.php
├── Encoder
│ ├── DecodeNotPossible.php
│ ├── EncodeNotPossible.php
│ ├── Encoder.php
│ └── JsonEncoder.php
├── EventSerializer.php
├── Normalizer
│ └── IdNormalizer.php
├── SerializeException.php
├── SerializedEvent.php
└── Upcast
│ ├── Upcast.php
│ ├── Upcaster.php
│ └── UpcasterChain.php
├── Snapshot
├── Adapter
│ ├── InMemorySnapshotAdapter.php
│ ├── Psr16SnapshotAdapter.php
│ ├── Psr6SnapshotAdapter.php
│ ├── SnapshotAdapter.php
│ └── SnapshotNotFound.php
├── AdapterNotFound.php
├── AdapterRepository.php
├── ArrayAdapterRepository.php
├── DefaultSnapshotStore.php
├── Snapshot.php
├── SnapshotException.php
├── SnapshotNotConfigured.php
├── SnapshotNotFound.php
├── SnapshotStore.php
└── SnapshotVersionInvalid.php
├── Store
├── ArchivedHeader.php
├── ArrayStream.php
├── Criteria
│ ├── AggregateIdCriterion.php
│ ├── AggregateNameCriterion.php
│ ├── ArchivedCriterion.php
│ ├── Criteria.php
│ ├── CriteriaBuilder.php
│ ├── CriterionNotFound.php
│ ├── EventIdCriterion.php
│ ├── EventsCriterion.php
│ ├── FromIndexCriterion.php
│ ├── FromPlayheadCriterion.php
│ ├── StreamCriterion.php
│ ├── ToIndexCriterion.php
│ └── ToPlayheadCriterion.php
├── DoctrineDbalStore.php
├── DoctrineDbalStoreStream.php
├── Header
│ ├── EventIdHeader.php
│ ├── IndexHeader.php
│ ├── PlayheadHeader.php
│ ├── RecordedOnHeader.php
│ └── StreamNameHeader.php
├── InMemoryStore.php
├── InvalidStreamName.php
├── InvalidType.php
├── LockingNotImplemented.php
├── MissingDataForStorage.php
├── ReadOnlyStore.php
├── Store.php
├── StoreException.php
├── StoreIsReadOnly.php
├── Stream.php
├── StreamClosed.php
├── StreamDoctrineDbalStore.php
├── StreamDoctrineDbalStoreStream.php
├── StreamReadOnlyStore.php
├── StreamStartHeader.php
├── StreamStore.php
├── SubscriptionStore.php
├── UniqueConstraintViolation.php
├── UnsupportedCriterion.php
└── WrongQueryResult.php
├── Subscription
├── Engine
│ ├── AlreadyProcessing.php
│ ├── CatchUpSubscriptionEngine.php
│ ├── DefaultSubscriptionEngine.php
│ ├── Error.php
│ ├── ErrorDetected.php
│ ├── EventFilteredStoreMessageLoader.php
│ ├── GapResolverStoreMessageLoader.php
│ ├── GeneratorStream.php
│ ├── MessageLoader.php
│ ├── ProcessedResult.php
│ ├── Result.php
│ ├── StoreMessageLoader.php
│ ├── SubscriberNotFound.php
│ ├── SubscriptionCollection.php
│ ├── SubscriptionEngine.php
│ ├── SubscriptionEngineCriteria.php
│ ├── SubscriptionManager.php
│ ├── ThrowOnErrorSubscriptionEngine.php
│ └── UnexpectedError.php
├── Lookup
│ ├── Lookup.php
│ └── MessageNotFound.php
├── NoErrorToRetry.php
├── Repository
│ ├── RunSubscriptionEngineRepository.php
│ └── RunSubscriptionEngineRepositoryManager.php
├── RetryStrategy
│ ├── ClockBasedRetryStrategy.php
│ ├── ConditionalRetryStrategy.php
│ ├── NoRetryStrategy.php
│ ├── RetryStrategy.php
│ ├── RetryStrategyNotFound.php
│ ├── RetryStrategyRepository.php
│ └── UnexpectedError.php
├── RunMode.php
├── Status.php
├── Store
│ ├── DoctrineSubscriptionStore.php
│ ├── InMemorySubscriptionStore.php
│ ├── LockableSubscriptionStore.php
│ ├── SubscriptionAlreadyExists.php
│ ├── SubscriptionCriteria.php
│ ├── SubscriptionNotFound.php
│ ├── SubscriptionStore.php
│ └── TransactionCommitNotPossible.php
├── Subscriber
│ ├── ArgumentResolver
│ │ ├── AggregateIdArgumentResolver.php
│ │ ├── ArgumentResolver.php
│ │ ├── EventArgumentResolver.php
│ │ ├── LookupResolver.php
│ │ ├── MessageArgumentResolver.php
│ │ └── RecordedOnArgumentResolver.php
│ ├── BatchableSubscriber.php
│ ├── DuplicateSubscriberId.php
│ ├── MetadataSubscriberAccessor.php
│ ├── MetadataSubscriberAccessorRepository.php
│ ├── NoSuitableResolver.php
│ ├── RealSubscriberAccessor.php
│ ├── SubscriberAccessor.php
│ ├── SubscriberAccessorRepository.php
│ ├── SubscriberHelper.php
│ └── SubscriberUtil.php
├── Subscription.php
├── SubscriptionError.php
└── ThrowableToErrorContextTransformer.php
└── Test
└── IncrementalRamseyUuidFactory.php
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM php:8.3
2 |
3 | ARG EXTENSIONS="pcntl zip intl bcmath"
4 |
5 | RUN apt-get update && apt-get install -y \
6 | git \
7 | zip \
8 | unzip \
9 | curl \
10 | && rm -rf /var/lib/apt/lists/*
11 |
12 | COPY --from=composer /usr/bin/composer /usr/bin/composer
13 |
14 | ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
15 |
16 | RUN chmod +x /usr/local/bin/install-php-extensions && \
17 | install-php-extensions $EXTENSIONS
18 |
19 | RUN mkdir -p /tmp/blackfire \
20 | && architecture=$(uname -m) \
21 | && curl -A "Docker" -L https://blackfire.io/api/v1/releases/cli/linux/$architecture | tar zxp -C /tmp/blackfire \
22 | && mv /tmp/blackfire/blackfire /usr/bin/blackfire \
23 | && rm -Rf /tmp/blackfire
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2020 Daniel Badura & David Badura
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/UPGRADE-3.0.md:
--------------------------------------------------------------------------------
1 | The upgrade path is located in our docs. Please have a look at
2 | [here](https://patchlevel.github.io/event-sourcing-docs/3.0/UPGRADE-3.0/).
3 |
--------------------------------------------------------------------------------
/deptrac-baseline.yaml:
--------------------------------------------------------------------------------
1 | deptrac:
2 | skip_violations:
3 | Patchlevel\EventSourcing\Aggregate\AggregateRootId:
4 | - Patchlevel\EventSourcing\Serializer\Normalizer\IdNormalizer
5 | Patchlevel\EventSourcing\Aggregate\CustomId:
6 | - Patchlevel\EventSourcing\Serializer\Normalizer\IdNormalizer
7 | Patchlevel\EventSourcing\Aggregate\Uuid:
8 | - Patchlevel\EventSourcing\Serializer\Normalizer\IdNormalizer
9 | Patchlevel\EventSourcing\Attribute\Processor:
10 | - Patchlevel\EventSourcing\Subscription\RunMode
11 | Patchlevel\EventSourcing\Attribute\Projector:
12 | - Patchlevel\EventSourcing\Subscription\RunMode
13 | Patchlevel\EventSourcing\Attribute\Stream:
14 | - Patchlevel\EventSourcing\Aggregate\AggregateRoot
15 | Patchlevel\EventSourcing\Attribute\Subscriber:
16 | - Patchlevel\EventSourcing\Subscription\RunMode
17 |
--------------------------------------------------------------------------------
/docker-compose.yaml:
--------------------------------------------------------------------------------
1 | services:
2 | postgres:
3 | image: postgres:alpine
4 | environment:
5 | - POSTGRES_PASSWORD=postgres
6 | - POSTGRES_DB=eventstore
7 | ports:
8 | - 5432:5432
9 |
10 | mysql:
11 | image: mysql:8
12 | environment:
13 | - MYSQL_ALLOW_EMPTY_PASSWORD="yes"
14 | - MYSQL_DATABASE=eventstore
15 | ports:
16 | - 3306:3306
--------------------------------------------------------------------------------
/infection.json.dist:
--------------------------------------------------------------------------------
1 | {
2 | "source": {
3 | "directories": [
4 | "src"
5 | ]
6 | },
7 | "logs": {
8 | "text": "infection.log",
9 | "html": "infection.html",
10 | "stryker": {
11 | "report": "/[0-9]+.[0-9]+.x/"
12 | }
13 | },
14 | "mutators": {
15 | "@default": true
16 | },
17 | "minMsi": 72,
18 | "minCoveredMsi": 95,
19 | "testFrameworkOptions": "--testsuite=unit"
20 | }
21 |
--------------------------------------------------------------------------------
/phpstan.neon.dist:
--------------------------------------------------------------------------------
1 | includes:
2 | - phpstan-baseline.neon
3 |
4 | parameters:
5 | level: max
6 | paths:
7 | - src
8 | ignoreErrors:
9 | -
10 | identifier: missingType.generics
11 |
--------------------------------------------------------------------------------
/psalm_docs.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/renovate.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3 | "extends": [
4 | "local>patchlevel/.github:renovate-config"
5 | ]
6 | }
7 |
--------------------------------------------------------------------------------
/src/Aggregate/AggregateException.php:
--------------------------------------------------------------------------------
1 | aggregateName . '-' . $this->aggregateId;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Aggregate/AggregateRoot.php:
--------------------------------------------------------------------------------
1 | $events */
12 | public function catchUp(iterable $events): void;
13 |
14 | /** @return list