diff --git a/.github/workflows/docs-build-try.yml b/.github/workflows/docs-build-try.yml deleted file mode 100644 index bd943e1c..00000000 --- a/.github/workflows/docs-build-try.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Try build docs - -on: - pull_request: - push: - branches: - - "renovate/*" - -jobs: - build-try: - name: Deploy docs - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Set up Python - uses: actions/setup-python@v6 - with: - python-version: "3.x" - - - name: Install dependencies - run: pip install -r docs/requirements.txt - - - name: Build docs - working-directory: docs/ - run: | - mkdocs build --strict \ No newline at end of file diff --git a/.github/workflows/docs-build.yml b/.github/workflows/docs-build.yml deleted file mode 100644 index 6856b35a..00000000 --- a/.github/workflows/docs-build.yml +++ /dev/null @@ -1,93 +0,0 @@ -name: Publish docs - -on: - push: - branches: - - "[0-9]+.[0-9]+.x" - release: - types: - - published - -jobs: - build: - name: Deploy docs - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Set up Python - uses: actions/setup-python@v6 - with: - python-version: "3.x" - - - name: Install dependencies - run: pip install -r docs/requirements.txt - - - name: Set up git author - uses: oleksiyrudenko/gha-git-credentials@v2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Find latest release - id: latest_release - uses: pozetroninc/github-action-get-latest-release@v0.8.0 - with: - repository: ${{ github.repository }} - excludes: draft,prerelease - - - name: Normalize current versions - id: current - uses: actions/github-script@v9 - with: - script: return context.ref.match(/([0-9]+\.[0-9]+)\.(x|[0-9]+)/i)[1]; - result-encoding: string - - - name: Normalize latest versions - id: latest - uses: actions/github-script@v9 - with: - script: return "${{steps.latest_release.outputs.release}}".match(/([0-9]+\.[0-9]+)\.[0-9]+/i)[1]; - result-encoding: string - - - name: Setup deploy key - env: - DEPLOY_DOCS_KEY: ${{ secrets.DEPLOY_DOCS_KEY }} - run: | - # Setup SSH deploy key - mkdir -p ~/.ssh - echo "${DEPLOY_DOCS_KEY}" > ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa - ssh-keyscan -H github.com > ~/.ssh/known_hosts - - - run: git remote add doc git@github.com:patchlevel/event-sourcing-bundle-docs.git - - run: git fetch doc gh-pages --verbose - - - run: | - current_major=$(echo "${{ steps.current.outputs.result }}" | cut -d '.' -f 1) - current_minor=$(echo "${{ steps.current.outputs.result }}" | cut -d '.' -f 2) - - latest_major=$(echo "${{ steps.latest.outputs.result }}" | cut -d '.' -f 1) - latest_minor=$(echo "${{ steps.latest.outputs.result }}" | cut -d '.' -f 2) - - if [ "${{ steps.current.outputs.result }}" = "${{ steps.latest.outputs.result }}" ] - then - # Here we deploy a new latest version - mike deploy latest --config-file docs/mkdocs.yml --title="${{ steps.current.outputs.result }} (latest)" --push --remote doc - elif [ "$current_major" -lt "$latest_major" ] || \ - { [ "$current_major" -eq "$latest_major" ] && [ "$current_minor" -lt "$latest_minor" ]; } - then - # Here we deploy a version that's not the latest one and smaller as the latest version - mike deploy ${{ steps.current.outputs.result }} --config-file docs/mkdocs.yml --push --remote doc - fi - - run: | - # Check if the "latest" alias exists - HAS_LATEST=$(mike list --config-file docs/mkdocs.yml --rebase --remote doc | grep latest) || true - - # If so then it is set as the default version (to enable the index redirect) - if [ "${HAS_LATEST}" != "" ] - then - echo "Set latest as default" - mike set-default latest --config-file docs/mkdocs.yml --remote doc - fi \ No newline at end of file diff --git a/.github/workflows/docs-deploy.yml b/.github/workflows/docs-deploy.yml new file mode 100644 index 00000000..7cb425e0 --- /dev/null +++ b/.github/workflows/docs-deploy.yml @@ -0,0 +1,22 @@ +name: Publish docs + +on: + push: + branches: + - "[0-9]+.[0-9]+.x" + release: + types: + - published + +jobs: + trigger: + runs-on: ubuntu-latest + steps: + - name: Trigger workflow in other repo + run: | + curl -L -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.ORGANIZATION_ADMIN_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2026-03-10" \ + https://api.github.com/repos/patchlevel/patchlevel.dev/actions/workflows/prod-deployment.yaml/dispatches \ + -d '{"ref":"main"}' \ No newline at end of file diff --git a/bin/docs-extract-php-code b/bin/docs-extract-php-code index efcbf252..d50b642d 100755 --- a/bin/docs-extract-php-code +++ b/bin/docs-extract-php-code @@ -23,7 +23,7 @@ if (file_exists($targetDir)) { mkdir($targetDir); $finder = new Symfony\Component\Finder\Finder(); -$finder->files()->in(__DIR__ . '/../docs/pages')->name('*.md'); +$finder->files()->in(__DIR__ . '/../docs')->name('*.md'); foreach ($finder as $file) { $fileName = pathinfo($file->getBasename(), PATHINFO_FILENAME); diff --git a/bin/docs-inject-php-code b/bin/docs-inject-php-code index 8cd0e05f..e4e81ead 100755 --- a/bin/docs-inject-php-code +++ b/bin/docs-inject-php-code @@ -25,7 +25,7 @@ if (!file_exists($targetDir)) { } $finder = new Symfony\Component\Finder\Finder(); -$finder->files()->in(__DIR__ . '/../docs/pages')->name('*.md'); +$finder->files()->in(__DIR__ . '/../docs')->name('*.md'); foreach ($finder as $file) { $fileName = pathinfo($file->getBasename(), PATHINFO_FILENAME); diff --git a/docs/pages/configuration.md b/docs/configuration.md similarity index 72% rename from docs/pages/configuration.md rename to docs/configuration.md index 019668ab..2ed5e628 100644 --- a/docs/pages/configuration.md +++ b/docs/configuration.md @@ -1,15 +1,15 @@ # Configuration -!!! info +:::note +You can find out more about event sourcing in the library +[documentation](/docs/event-sourcing/latest). +This documentation is limited to bundle integration and configuration. +::: - You can find out more about event sourcing in the library - [documentation](https://event-sourcing.patchlevel.io/latest/). - This documentation is limited to bundle integration and configuration. - -!!! tip +:::tip +We provide a [default configuration](installation.md#configuration-file) that should work for most projects. +::: - We provide a [default configuration](./installation.md#configuration-file) that should work for most projects. - ## Aggregate A path must be specified for Event Sourcing to know where to look for your aggregates. @@ -27,14 +27,15 @@ patchlevel_event_sourcing: - '%kernel.project_dir%/src/Hotel/Domain' - '%kernel.project_dir%/src/Room/Domain' ``` -!!! note - The library will automatically register all classes marked with the `#[Aggregate]` attribute in the specified paths. - -!!! tip +:::note +The library will automatically register all classes marked with the `#[Aggregate]` attribute in the specified paths. +::: + +:::tip +If you want to learn more about aggregates, read the [library documentation](/docs/event-sourcing/latest/aggregate). +::: - If you want to learn more about aggregates, read the [library documentation](https://event-sourcing.patchlevel.io/latest/aggregate/). - ## Events A path must be specified for Event Sourcing to know where to look for your events. @@ -52,10 +53,11 @@ patchlevel_event_sourcing: - '%kernel.project_dir%/src/Hotel/Domain/Event' - '%kernel.project_dir%/src/Room/Domain/Event' ``` -!!! tip - If you want to learn more about events, read the [library documentation](https://event-sourcing.patchlevel.io/latest/events/). - +:::tip +If you want to learn more about events, read the [library documentation](/docs/event-sourcing/latest/events). +::: + ## Custom Headers If you want to implement custom headers for your application, you must specify the @@ -74,10 +76,11 @@ patchlevel_event_sourcing: - '%kernel.project_dir%/src/Hotel/Domain/Header' - '%kernel.project_dir%/src/Room/Domain/Header' ``` -!!! tip - If you want to learn more about custom headers, read the [library documentation](https://event-sourcing.patchlevel.io/latest/message/#custom-headers). - +:::tip +If you want to learn more about custom headers, read the [library documentation](/docs/event-sourcing/latest/message/#custom-headers). +::: + ## Connection You have to specify the connection url to the event store. @@ -87,11 +90,12 @@ patchlevel_event_sourcing: connection: url: '%env(EVENTSTORE_URL)%' ``` -!!! note - You can find out more about how to create a connection - [here](https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html) - +:::note +You can find out more about how to create a connection +[here](https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html) +::: + ### Connection for Projections Per default, our event sourcing connection is not available to use in your application. @@ -103,24 +107,28 @@ patchlevel_event_sourcing: url: '%env(EVENTSTORE_URL)%' provide_dedicated_connection: true ``` -!!! warning - If you use doctrine migrations, you should exclude you projection tables from the schema generation. - The schema is managed by the subscription engine and should not be managed by doctrine. - -!!! tip +:::warning +If you use doctrine migrations, you should exclude you projection tables from the schema generation. +The schema is managed by the subscription engine and should not be managed by doctrine. +::: + +:::tip +You can autowire the connection in your services like this: - You can autowire the connection in your services like this: - - ```php - use Doctrine\DBAL\Connection; - +```php +use Doctrine\DBAL\Connection; + +class YourService +{ public function __construct( private readonly Connection $projectionConnection, ) { } - ``` - +} +``` +::: + ### Doctrine Bundle If you have installed the [doctrine bundle](https://github.com/doctrine/DoctrineBundle), @@ -137,21 +145,22 @@ patchlevel_event_sourcing: connection: service: doctrine.dbal.eventstore_connection ``` -!!! danger - Do not use the same connection for event sourcing and your projections, - otherwise you may run into transaction problems. - -!!! warning +:::danger +Do not use the same connection for event sourcing and your projections, +otherwise you may run into transaction problems. +::: + +:::warning +If you want to use the same connection as doctrine orm, then you have to set the flag `merge_orm_schema`. +Otherwise you should avoid using the same connection as other tools. +::: - If you want to use the same connection as doctrine orm, then you have to set the flag `merge_orm_schema`. - Otherwise you should avoid using the same connection as other tools. - -!!! note +:::note +You can find out more about the dbal configuration +[here](https://symfony.com/bundles/DoctrineBundle/current/configuration.html). +::: - You can find out more about the dbal configuration - [here](https://symfony.com/bundles/DoctrineBundle/current/configuration.html). - If you are using Doctrine for your projections too, you need to create a dedicated connection for this. You can do this by defining a new connection named `projection` in the `doctrine.yaml` file and use the same connection url as for the event store. @@ -169,16 +178,17 @@ patchlevel_event_sourcing: connection: service: doctrine.dbal.eventstore_connection ``` -!!! warning - You should exclude your projection tables from the schema generation. - - ```yaml - doctrine: - dbal: - schema_filter: ~^(projection_)~ - ``` - +:::warning +You should exclude your projection tables from the schema generation. + +```yaml +doctrine: + dbal: + schema_filter: ~^(projection_)~ +``` +::: + Then you can use this connection in your projections. If you are using autowiring you can inject the right connection `Connection $projectionConnection` parameter name. The prefix `projection` is used to identify the connection. @@ -218,10 +228,10 @@ Following store types are available: - `in_memory` - `custom` -!!! note +:::note +If you use `custom` store type, you need to set the service id under `patchlevel_event_sourcing.store.service`. +::: - If you use `custom` store type, you need to set the service id under `patchlevel_event_sourcing.store.service`. - ### Change table Name You can change the table name of the event store. @@ -242,10 +252,11 @@ patchlevel_event_sourcing: store: read_only: true ``` -!!! tip - This is useful if you have maintenance work on the event store and you want to avoid side effects. - +:::tip +This is useful if you have maintenance work on the event store and you want to avoid side effects. +::: + ### Merge ORM Schema You can also merge the schema with doctrine orm. You have to set the following flag for this: @@ -255,19 +266,20 @@ patchlevel_event_sourcing: store: merge_orm_schema: true ``` -!!! warning - If you want to merge the schema, then the same doctrine connection must be used as with the doctrine orm. - Otherwise errors may occur! - -!!! note +:::warning +If you want to merge the schema, then the same doctrine connection must be used as with the doctrine orm. +Otherwise errors may occur! +::: + +:::note +All schema relevant commands are removed if you activate this option. You should use the doctrine commands then. +::: - All schema relevant commands are removed if you activate this option. You should use the doctrine commands then. - -!!! tip +:::tip +If you want to learn more about store, read the [library documentation](/docs/event-sourcing/latest/store). +::: - If you want to learn more about store, read the [library documentation](https://event-sourcing.patchlevel.io/latest/store/). - ### Kernel Reset Only available in `in_memory` store. If you want to reset the store after each kernel request, you can activate this option. @@ -295,16 +307,17 @@ patchlevel_event_sourcing: translators: - Patchlevel\EventSourcing\Message\Translator\AggregateToStreamHeaderTranslator ``` -!!! danger - Make sure that you use different table names for the old and new store. - Otherwise your event store will be destroyed. - -!!! tip +:::danger +Make sure that you use different table names for the old and new store. +Otherwise your event store will be destroyed. +::: + +:::tip +Set the `read_only` flag to `true` for the old store to avoid side effects +and missing events during the migration. +::: - Set the `read_only` flag to `true` for the old store to avoid side effects - and missing events during the migration. - ## Migration You can use [doctrine migrations](https://www.doctrine-project.org/projects/migrations.html) to manage the schema. @@ -317,11 +330,11 @@ patchlevel_event_sourcing: ``` ## Subscription -!!! tip +:::tip +You can find out more about subscriptions in the library +[documentation](/docs/event-sourcing/latest/subscription). +::: - You can find out more about subscriptions in the library - [documentation](https://event-sourcing.patchlevel.io/latest/subscription/). - ### Store You can change where the subscription engine stores its necessary information about the subscription. @@ -343,11 +356,12 @@ patchlevel_event_sourcing: options: table_name: 'my_subscription_store' ``` -!!! tip - If you are using the [doctrine-test-bundle](https://github.com/dmaicher/doctrine-test-bundle), - you can use the `static_in_memory` store for testing. - +:::tip +If you are using the [doctrine-test-bundle](https://github.com/dmaicher/doctrine-test-bundle), +you can use the `static_in_memory` store for testing. +::: + ### Catch Up If aggregates are used in the processors and new events are generated there, @@ -371,10 +385,11 @@ patchlevel_event_sourcing: subscription: throw_on_error: true ``` -!!! warning - This option should not be used in production. The normal behavior is to log the error and continue. - +:::warning +This option should not be used in production. The normal behavior is to log the error and continue. +::: + ### Run After Aggregate Save If you want to run the subscription engine after an aggregate is saved, you can activate this option. @@ -395,10 +410,11 @@ patchlevel_event_sourcing: subscription: auto_setup: true ``` -!!! note - This works only before each http requests and not if you use the console commands. - +:::note +This works only before each http requests and not if you use the console commands. +::: + ### Rebuild After File Change If you want to rebuild the subscription engine after a file change, you can activate this option. @@ -409,14 +425,15 @@ patchlevel_event_sourcing: subscription: rebuild_after_file_change: true ``` -!!! note - This works only before each http requests and not if you use the console commands. - -!!! tip +:::note +This works only before each http requests and not if you use the console commands. +::: + +:::tip +This is using the cache system to store the latest file change time. You can change the cache pool with the `cache_pool` option. +::: - This is using the cache system to store the latest file change time. You can change the cache pool with the `cache_pool` option. - ### Gap Detection Depending on the database you are using for the eventstore it may be happening that your subscriptions are skipping some @@ -431,14 +448,15 @@ patchlevel_event_sourcing: subscription: gap_detection: ~ ``` -!!! info - For more context you can read more about this in [this issue](https://github.com/patchlevel/event-sourcing/issues/727#issuecomment-2757297536). - -!!! tip +:::note +For more context you can read more about this in [this issue](https://github.com/patchlevel/event-sourcing/issues/727#issuecomment-2757297536). +::: + +:::tip +You can use both techniques locking and gap detecion to mitigate gaps happening in the subscriptions. +::: - You can use both techniques locking and gap detecion to mitigate gaps happening in the subscriptions. - You can also define how often the gap detection should re-check the gap and how long it should wait, in this example we instantly retry the first time, then we wait 500ms and after that we check a last time after 1 second. @@ -479,10 +497,11 @@ patchlevel_event_sourcing: command_bus: service: command.bus ``` -!!! note - You can find out more about the command bus and the aggregate handlers [here](https://event-sourcing.patchlevel.io/latest/command_bus/). - +:::note +You can find out more about the command bus and the aggregate handlers [here](/docs/event-sourcing/latest/command-bus). +::: + ### Instant Retry You can define the default instant retry configuration for the command bus. @@ -496,10 +515,11 @@ patchlevel_event_sourcing: default_exceptions: - Patchlevel\EventSourcing\Repository\AggregateOutdated ``` -!!! note - You can find out more about instant retry [here](https://event-sourcing.patchlevel.io/latest/command_bus/#instant-retry). - +:::note +You can find out more about instant retry [here](/docs/event-sourcing/latest/command-bus/#instant-retry). +::: + ## Query Bus You can enable the query bus integration to use queries to retrieve data from your system. For this bundle we provide @@ -519,10 +539,11 @@ patchlevel_event_sourcing: query_bus: service: query.bus ``` -!!! note - You can find out more about the query bus [here](https://event-sourcing.patchlevel.io/latest/query_bus/). - +:::note +You can find out more about the query bus [here](/docs/event-sourcing/latest/query-bus). +::: + ## Event Bus You can enable the event bus to listen for events and messages synchronously. @@ -532,10 +553,11 @@ But you should consider using the subscription engine for this. patchlevel_event_sourcing: event_bus: ~ ``` -!!! note - Default is the patchlevel [event bus](https://event-sourcing.patchlevel.io/latest/event_bus/). - +:::note +Default is the patchlevel [event bus](/docs/event-sourcing/latest/event-bus). +::: + ### Patchlevel (Default) Event Bus First of all we have our own default event bus. @@ -546,10 +568,11 @@ patchlevel_event_sourcing: event_bus: type: default ``` -!!! note - You don't have to specify this as it is the default value. - +:::note +You don't have to specify this as it is the default value. +::: + ### Symfony Event Bus But you can also use [Symfony Messenger](https://symfony.com/doc/current/messenger.html). @@ -602,11 +625,12 @@ patchlevel_event_sourcing: type: psr14 service: my.event.bus.service ``` -!!! note - Like the Symfony event bus, the event sourcing attributes no longer work here. - You have to use the system that comes with the respective psr14 implementation. - +:::note +Like the Symfony event bus, the event sourcing attributes no longer work here. +You have to use the system that comes with the respective psr14 implementation. +::: + ### Custom Event Bus You can also use your own event bus that implements the `Patchlevel\EventSourcing\EventBus\EventBus` interface. @@ -617,11 +641,12 @@ patchlevel_event_sourcing: type: custom service: my.event.bus.service ``` -!!! note - Like the Symfony event bus, the event sourcing attributes no longer work here. - You have to use the system that comes with the respective custom implementation. - +:::note +Like the Symfony event bus, the event sourcing attributes no longer work here. +You have to use the system that comes with the respective custom implementation. +::: + ## Snapshot You can use symfony cache to define the target of the snapshot store. @@ -660,10 +685,11 @@ final class Profile extends BasicAggregateRoot // ... } ``` -!!! note - You can find out more about snapshots [here](https://event-sourcing.patchlevel.io/latest/snapshots/). - +:::note +You can find out more about snapshots [here](/docs/event-sourcing/latest/snapshots). +::: + ## Cryptography You can use the library to encrypt and decrypt personal data. @@ -674,12 +700,13 @@ patchlevel_event_sourcing: cryptography: use_encrypted_field_name: true ``` -!!! tip - You should activate `use_encrypted_field_name` to mark the fields that are encrypted. - That allows you later to migrate not encrypted fields to encrypted fields. - If you have already encrypted fields, you can activate `fallback_to_field_name` to use the old field name as fallback. - +:::tip +You should activate `use_encrypted_field_name` to mark the fields that are encrypted. +That allows you later to migrate not encrypted fields to encrypted fields. +If you have already encrypted fields, you can activate `fallback_to_field_name` to use the old field name as fallback. +::: + If you want to use another algorithm, you can specify this here: ```yaml @@ -687,10 +714,11 @@ patchlevel_event_sourcing: cryptography: algorithm: 'aes-256-gcm' ``` -!!! note - You can find out more about personal data [here](https://event-sourcing.patchlevel.io/latest/personal_data/). - +:::note +You can find out more about personal data [here](/docs/event-sourcing/latest/personal-data). +::: + ## Clock The clock is used to return the current time as DateTimeImmutable. @@ -705,10 +733,11 @@ when@test: clock: freeze: '2020-01-01 22:00:00' ``` -!!! note - If freeze is not set, then the system clock is used. - +:::note +If freeze is not set, then the system clock is used. +::: + ### Symfony Clock Since symfony 6.2 there is a [clock](https://symfony.com/doc/current/components/clock.html) implementation diff --git a/docs/pages/getting_started.md b/docs/getting-started.md similarity index 87% rename from docs/pages/getting_started.md rename to docs/getting-started.md index 7bd2d18f..96ed22f8 100644 --- a/docs/pages/getting_started.md +++ b/docs/getting-started.md @@ -5,11 +5,11 @@ We keep the example small, so we can only create hotels and let guests check in For this example we use [symfony/mailer](https://symfony.com/doc/current/mailer.html). -!!! info +:::note +First of all, the bundle has to be installed and configured. +If you haven't already done so, see the [installation introduction](installation.md). +::: - First of all, the bundle has to be installed and configured. - If you haven't already done so, see the [installation introduction](installation.md). - ## Define some events First we define the events that happen in our system. @@ -68,10 +68,11 @@ final class GuestIsCheckedOut } } ``` -!!! note - You can find out more about events in the [library](https://event-sourcing.patchlevel.io/latest/events/). - +:::note +You can find out more about events in the [library](/docs/event-sourcing/latest/events). +::: + ## Define aggregates Next we need to define the hotel aggregate. @@ -168,10 +169,11 @@ final class Hotel extends BasicAggregateRoot } } ``` -!!! note - You can find out more about aggregates in the [library](https://event-sourcing.patchlevel.io/latest/aggregate/). - +:::note +You can find out more about aggregates in the [library](/docs/event-sourcing/latest/aggregate). +::: + ## Define projections Now we want to see which guests are currently checked in at a hotel or when a guest checked in and out. @@ -276,14 +278,15 @@ final class GuestProjection } } ``` -!!! warning - autoconfigure need to be enabled, otherwise you need add the `event_sourcing.subscriber` tag. - -!!! note +:::warning +autoconfigure need to be enabled, otherwise you need add the `event_sourcing.subscriber` tag. +::: + +:::note +You can find out more about projections in the [library](/docs/event-sourcing/latest/subscription). +::: - You can find out more about projections in the [library](https://event-sourcing.patchlevel.io/latest/subscription/). - ## Processor In our example we also want to send an email to the head office as soon as a guest is checked in. @@ -320,14 +323,15 @@ final class SendCheckInEmailProcessor } } ``` -!!! warning - autoconfigure need to be enabled, otherwise you need add the `event_sourcing.subscriber` tag. - -!!! note +:::warning +autoconfigure need to be enabled, otherwise you need add the `event_sourcing.subscriber` tag. +::: + +:::note +You can find out more about processor in the [library](/docs/event-sourcing/latest/subscription) +::: - You can find out more about processor in the [library](https://event-sourcing.patchlevel.io/latest/subscription/) - ## Database setup So that we can actually write the data to a database, we need the associated schema and databases. @@ -342,10 +346,11 @@ or you can use doctrine migrations: bin/console event-sourcing:migrations:diff bin/console event-sourcing:migrations:migrate ``` -!!! note - You can find out more about the cli in the [library](https://event-sourcing.patchlevel.io/latest/cli/). - +:::note +You can find out more about the cli in the [library](/docs/event-sourcing/latest/cli). +::: + ## Usage We are now ready to use the Event Sourcing System. We can load, change and save aggregates. @@ -419,15 +424,14 @@ final class HotelController ``` ## Result -!!! success +:::success +We have successfully implemented and used event sourcing. - We have successfully implemented and used event sourcing. - - Feel free to browse further in the documentation for more detailed information. - If there are still open questions, create a ticket on Github and we will try to help you. - -!!! note +Feel free to browse further in the documentation for more detailed information. +If there are still open questions, create a ticket on Github and we will try to help you. +::: - This documentation is limited to the bundle integration. - You should also read the [library documentation](https://event-sourcing.patchlevel.io/latest/). - \ No newline at end of file +:::note +This documentation is limited to the bundle integration. +You should also read the [library documentation](/docs/event-sourcing/latest). +::: \ No newline at end of file diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 00000000..56e3b402 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,40 @@ +# Event-Sourcing-Bundle + +An event sourcing bundle, complete with all the essential features, +powered by the reliable Doctrine ecosystem and focused on developer experience. +This bundle is a [symfony](https://symfony.com/) integration +for [event-sourcing](https://github.com/patchlevel/event-sourcing) library. + +## Features + +* Everything is included in the package for event sourcing +* Based on [doctrine dbal](https://github.com/doctrine/dbal) and their ecosystem +* Developer experience oriented and fully typed +* Automatic [snapshot](/docs/event-sourcing/latest/snapshots)-system to boost your performance +* [Split](/docs/event-sourcing/latest/split-stream) big aggregates into multiple streams +* Versioned and managed lifecycle of [subscriptions](/docs/event-sourcing/latest/subscription) like projections and processors +* Safe usage of [Personal Data](/docs/event-sourcing/latest/personal-data) with crypto-shredding +* Smooth [upcasting](/docs/event-sourcing/latest/upcasting) of old events +* Simple setup with [scheme management](/docs/event-sourcing/latest/store) and [doctrine migration](/docs/event-sourcing/latest/store) +* Built in [cli commands](/docs/event-sourcing/latest/cli) with [symfony](https://symfony.com/) +* and much more... + +## Installation + +```bash +composer require patchlevel/event-sourcing-bundle +``` + +:::note +If you don't use the symfony flex recipe for this bundle, you need to follow +this [installation documentation](installation.md). +::: + +:::tip +Start with the [quickstart](getting-started.md) to get a feeling for the bundle. +::: + +## Integration + +* [Psalm](https://github.com/patchlevel/event-sourcing-psalm-plugin) +* [Admin Bundle](https://github.com/patchlevel/event-sourcing-admin-bundle) diff --git a/docs/pages/installation.md b/docs/installation.md similarity index 87% rename from docs/pages/installation.md rename to docs/installation.md index b9432835..f7e57de4 100644 --- a/docs/pages/installation.md +++ b/docs/installation.md @@ -11,10 +11,11 @@ The first thing to do is to install packet if it has not already been done. ```bash composer require patchlevel/event-sourcing-bundle ``` -!!! note - how to install [composer](https://getcomposer.org/doc/00-intro.md) - +:::note +how to install [composer](https://getcomposer.org/doc/00-intro.md) +::: + ## Enable bundle Then we have to activate the bundle in the `config/bundles.php`: @@ -77,10 +78,11 @@ Finally, we have to fill the ENV variable with a connection url. ```dotenv EVENTSTORE_URL="pdo-pgsql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8" ``` -!!! note - You can find out more about what a connection url looks like [here](https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url). - +:::note +You can find out more about what a connection url looks like [here](https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url). +::: + ## Database with Docker If you are using docker, you can use the following `compose.yaml` file to start a postgres database. @@ -120,7 +122,7 @@ For this you have to add the following configuration to the `.symfony.local.yaml workers: docker_compose: ~ ``` -!!! success - You have successfully installed the bundle. Now you can start with the [quickstart](./getting_started.md) to get a feeling for the bundle. - \ No newline at end of file +:::success +You have successfully installed the bundle. Now you can start with the [quickstart](getting-started.md) to get a feeling for the bundle. +::: \ No newline at end of file diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml deleted file mode 100644 index f8343080..00000000 --- a/docs/mkdocs.yml +++ /dev/null @@ -1,102 +0,0 @@ -# yaml-language-server: $schema=https://squidfunk.github.io/mkdocs-material/schema.json - -site_name: Event Sourcing Symfony Bundle -site_description: A lightweight but also all-inclusive event sourcing bundle with a focus on developer experience and based on doctrine dbal. -site_author: patchlevel -site_url: https://event-sourcing-bundle.patchlevel.io/ -repo_url: https://github.com/patchlevel/event-sourcing-bundle -repo_name: patchlevel/event-sourcing-bundle -edit_uri: edit/2.0.x/docs/pages/ -docs_dir: pages - -extra: - meta: - title: Event Sourcing Symfony Bundle - description: An event sourcing bundle, complete with all the essential features, powered by the reliable Doctrine ecosystem and focused on developer experience. - image: img/patchlevel-banner.png - social: - - icon: fontawesome/brands/github - link: https://github.com/patchlevel - - icon: fontawesome/solid/globe - link: https://patchlevel.de - - icon: fontawesome/brands/twitter - link: https://twitter.com/patchlevelhq - version: - provider: mike - analytics: - provider: custom - -extra_css: - - stylesheets/extra.css - -theme: - name: material - custom_dir: overrides - logo: assets/logo.png - favicon: assets/favicon.png - features: - - navigation.sections - - navigation.top - - navigation.indexes - - navigation.footer - - content.code.annotate - - content.code.copy - palette: - - media: "(prefers-color-scheme: light)" - scheme: default - primary: black - accent: blue - toggle: - icon: material/brightness-7 - name: Switch to dark mode - - media: "(prefers-color-scheme: dark)" - scheme: slate - primary: black - accent: blue - toggle: - icon: material/brightness-4 - name: Switch to light mode - -plugins: - - search: - - mike: - canonical_version: latest - -markdown_extensions: - - meta - - pymdownx.highlight: - anchor_linenums: true - extend_pygments_lang: - - name: php - lang: php - options: - startinline: true - - pymdownx.inlinehilite - - pymdownx.snippets: - auto_append: - - docs/includes/links.md - - admonition - - pymdownx.emoji: - emoji_index: !!python/name:materialx.emoji.twemoji - emoji_generator: !!python/name:materialx.emoji.to_svg - - def_list - - pymdownx.tasklist: - custom_checkbox: true - - pymdownx.superfences: - custom_fences: - - name: mermaid - class: mermaid - format: !!python/name:pymdownx.superfences.fence_code_format - -nav: - - Introduction: index.md - - Installation: installation.md - - Getting Started: getting_started.md - - Configuration: configuration.md - - Usage: usage.md - - Links: - - Blog: https://patchlevel.de/blog - - Library Documentation: https://event-sourcing.patchlevel.io/latest/ - - Admin Bundle: https://github.com/patchlevel/event-sourcing-admin-bundle - - Psalm Plugin: https://github.com/patchlevel/event-sourcing-psalm-plugin - - Hydrator: https://github.com/patchlevel/hydrator diff --git a/docs/overrides/assets/favicon.png b/docs/overrides/assets/favicon.png deleted file mode 100644 index 86e8fb7b..00000000 Binary files a/docs/overrides/assets/favicon.png and /dev/null differ diff --git a/docs/overrides/assets/logo.png b/docs/overrides/assets/logo.png deleted file mode 100644 index be170fed..00000000 Binary files a/docs/overrides/assets/logo.png and /dev/null differ diff --git a/docs/overrides/main.html b/docs/overrides/main.html deleted file mode 100644 index 9cfcb55a..00000000 --- a/docs/overrides/main.html +++ /dev/null @@ -1,18 +0,0 @@ -{% extends "base.html" %} - -{% block extrahead %} - - - - - - - -{% endblock %} - -{% block outdated %} -You're not viewing the latest version. - - Click here to go to latest. - -{% endblock %} \ No newline at end of file diff --git a/docs/overrides/partials/integrations/analytics/custom.html b/docs/overrides/partials/integrations/analytics/custom.html deleted file mode 100644 index af4cc148..00000000 --- a/docs/overrides/partials/integrations/analytics/custom.html +++ /dev/null @@ -1,13 +0,0 @@ - \ No newline at end of file diff --git a/docs/pages/index.md b/docs/pages/index.md deleted file mode 100644 index 04cd6ab3..00000000 --- a/docs/pages/index.md +++ /dev/null @@ -1,39 +0,0 @@ -# Event-Sourcing-Bundle - -An event sourcing bundle, complete with all the essential features, -powered by the reliable Doctrine ecosystem and focused on developer experience. -This bundle is a [symfony](https://symfony.com/) integration -for [event-sourcing](https://github.com/patchlevel/event-sourcing) library. - -## Features - -* Everything is included in the package for event sourcing -* Based on [doctrine dbal](https://github.com/doctrine/dbal) and their ecosystem -* Developer experience oriented and fully typed -* Automatic [snapshot](https://event-sourcing.patchlevel.io/latest/snapshots/)-system to boost your performance -* [Split](https://event-sourcing.patchlevel.io/latest/split_stream/) big aggregates into multiple streams -* Versioned and managed lifecycle of [subscriptions](https://event-sourcing.patchlevel.io/latest/subscription/) like projections and processors -* Safe usage of [Personal Data](https://event-sourcing.patchlevel.io/latest/personal_data/) with crypto-shredding -* Smooth [upcasting](https://event-sourcing.patchlevel.io/latest/upcasting/) of old events -* Simple setup with [scheme management](https://event-sourcing.patchlevel.io/latest/store/) and [doctrine migration](https://event-sourcing.patchlevel.io/latest/store/) -* Built in [cli commands](https://event-sourcing.patchlevel.io/latest/cli/) with [symfony](https://symfony.com/) -* and much more... - -## Installation - -```bash -composer require patchlevel/event-sourcing-bundle -``` -!!! info - - If you don't use the symfony flex recipe for this bundle, you need to follow - this [installation documentation](installation.md). - -!!! tip - - Start with the [quickstart](./getting_started.md) to get a feeling for the bundle. - -## Integration - -* [Psalm](https://github.com/patchlevel/event-sourcing-psalm-plugin) -* [Admin Bundle](https://github.com/patchlevel/event-sourcing-admin-bundle) diff --git a/docs/pages/stylesheets/extra.css b/docs/pages/stylesheets/extra.css deleted file mode 100644 index 26494c71..00000000 --- a/docs/pages/stylesheets/extra.css +++ /dev/null @@ -1,43 +0,0 @@ -:root > * { - --md-code-hl-number-color: #6897BB; - --md-code-hl-special-color: #C7CDD7; - --md-code-hl-function-color: #FFC66D; - --md-code-hl-constant-color: #9876AA; - --md-code-hl-keyword-color: #CC7832; - --md-code-hl-string-color: #6A8759; - --md-code-hl-name-color: red; - --md-code-hl-operator-color: #C7CDD7; - --md-code-hl-punctuation-color: #C7CDD7; - --md-code-hl-comment-color: #629755; - --md-code-hl-generic-color: red; - --md-code-hl-variable-color: #9876AA; - - --md-code-fg-color: #C7CDD7; - --md-code-bg-color: rgb(39, 42, 53); - --md-code-hl-color: red; -} - -p { - margin-block-start: 2em; - margin-block-end: 2em; -} - -.md-typeset code { - padding: .2em .4em; - font-size: .9em; - line-height: 1.8; - border-radius: .2rem; -} - -[data-md-color-scheme=default] .md-typeset code:not(pre code) { - background-color: #f5f5f5; - color: #36464e; -} - -.admonition-title { - margin-bottom: -1em !important; -} - -.md-nav__link--active { - font-weight: bold; -} \ No newline at end of file diff --git a/docs/project.json b/docs/project.json new file mode 100644 index 00000000..cfdca365 --- /dev/null +++ b/docs/project.json @@ -0,0 +1,24 @@ +{ + "navigation": [ + { + "title": "Introduction", + "file": "index.md" + }, + { + "title": "Installation", + "file": "installation.md" + }, + { + "title": "Getting Started", + "file": "getting-started.md" + }, + { + "title": "Configuration", + "file": "configuration.md" + }, + { + "title": "Usage", + "file": "usage.md" + } + ] +} diff --git a/docs/requirements.txt b/docs/requirements.txt deleted file mode 100644 index 4e1342ff..00000000 --- a/docs/requirements.txt +++ /dev/null @@ -1,11 +0,0 @@ -mkdocs==1.6.1 -mike==2.2.0 -markdown==3.10.2 -mkdocs-material==9.7.6 - -# Markdown extensions -Pygments==2.20.0 -pymdown-extensions==10.21.2 - -# MkDocs plugins -mkdocs-material-extensions==1.3.1 \ No newline at end of file diff --git a/docs/pages/usage.md b/docs/usage.md similarity index 86% rename from docs/pages/usage.md rename to docs/usage.md index 93b698cd..c11720b4 100644 --- a/docs/pages/usage.md +++ b/docs/usage.md @@ -3,12 +3,12 @@ Here you will find some examples of how to use the bundle. But we provide only examples for specific symfony features. -!!! info +:::note +You can find out more about event sourcing in the library +[documentation](/docs/event-sourcing/latest). +This documentation is limited to bundle integration and configuration. +::: - You can find out more about event sourcing in the library - [documentation](https://event-sourcing.patchlevel.io/latest/). - This documentation is limited to bundle integration and configuration. - ## Repository You can access the specific repositories using the `RepositoryManager::get`. Or inject directly the right repository via @@ -140,24 +140,25 @@ services: - name: event_sourcing.listener priority: 16 ``` -!!! warning - You have to deactivate the `autoconfigure` for this service, - otherwise the service will be added twice. - +:::warning +You have to deactivate the `autoconfigure` for this service, +otherwise the service will be added twice. +::: + ## Normalizer This bundle adds more Symfony specific normalizers in addition to the existing built-in normalizers. -!!! note +:::note +You can find the other build-in normalizers [here](/docs/event-sourcing/latest/normalizer/#built-in-normalizer) +::: - You can find the other build-in normalizers [here](https://event-sourcing.patchlevel.io/latest/normalizer/#built-in-normalizer) - -!!! tip +:::tip +The Hydrator can automatically determine the appropriate normalizer based on the data type and annotations. +You don't have to specify the normalizer manually like in the example below. +::: - The Hydrator can automatically determine the appropriate normalizer based on the data type and annotations. - You don't have to specify the normalizer manually like in the example below. - ### Uid With the `Uid` Normalizer, as the name suggests, you can convert Symfony Uuid and Ulid objects to a string and back again. @@ -172,15 +173,16 @@ final class DTO public Uuid $id; } ``` -!!! warning - The symfony uuid don't implement the `AggregateId` interface, so it can not be used as an aggregate id directly. - Use instead the `Patchlevel\EventSourcing\Aggregate\Uuid` class. - -!!! tip +:::warning +The symfony uuid don't implement the `AggregateId` interface, so it can not be used as an aggregate id directly. +Use instead the `Patchlevel\EventSourcing\Aggregate\Uuid` class. +::: + +:::tip +Use the `Uuid` implementation and `IdNormalizer` from the library to use it as an aggregate id. +::: - Use the `Uuid` implementation and `IdNormalizer` from the library to use it as an aggregate id. - ### DatePoint With the `DatePoint` Normalizer, you can convert a `DatePoint` object to a string and back again.