diff --git a/docs/_data/menu.yml b/docs/_data/menu.yml index 13556a58..932f4a59 100644 --- a/docs/_data/menu.yml +++ b/docs/_data/menu.yml @@ -13,10 +13,8 @@ Stop Russia's Aggression: Support Ukraine: https://savelife.in.ua/en/ Getting Started: - 1. Create an Aggregate Root: '/docs/event-sourcing/create-an-aggregate-root/' - 2. Create Events and Commands: '/docs/event-sourcing/create-events-and-commands/' - 3. Configure Persistence: '/docs/event-sourcing/configure-persistence/' - 4. Bootstrap: '/docs/event-sourcing/bootstrap/' + Intro and install: '/docs/getting-started/introduction/' + 1. Create an Aggregate Root: '/docs/getting-started/create-aggregate-root/' Serialization: Object Mapper: '/docs/serialization/object-mapper/' diff --git a/docs/docs/event-sourcing/1-creating-an-aggregate-root.md b/docs/docs/event-sourcing/1-creating-an-aggregate-root.md index 5cb6031c..bfe265ba 100644 --- a/docs/docs/event-sourcing/1-creating-an-aggregate-root.md +++ b/docs/docs/event-sourcing/1-creating-an-aggregate-root.md @@ -1,6 +1,5 @@ --- permalink: /docs/event-sourcing/create-an-aggregate-root/ -redirect_from: /docs/getting-started/create-an-aggregate-root/ title: Creating an Aggregate Root --- diff --git a/docs/docs/event-sourcing/2-create-events-and-commands.md b/docs/docs/event-sourcing/2-create-events-and-commands.md index db642f4d..9edddd0b 100644 --- a/docs/docs/event-sourcing/2-create-events-and-commands.md +++ b/docs/docs/event-sourcing/2-create-events-and-commands.md @@ -1,6 +1,5 @@ --- permalink: /docs/event-sourcing/create-events-and-commands/ -redirect_from: /docs/getting-started/create-events-and-commands/ title: Create events and commands --- diff --git a/docs/docs/event-sourcing/3-configure-persistence.md b/docs/docs/event-sourcing/3-configure-persistence.md index 2a271179..f7e6a837 100644 --- a/docs/docs/event-sourcing/3-configure-persistence.md +++ b/docs/docs/event-sourcing/3-configure-persistence.md @@ -1,6 +1,5 @@ --- permalink: /docs/event-sourcing/configure-persistence/ -redirect_from: /docs/getting-started/configure-persistence/ title: Configure Persistence --- diff --git a/docs/docs/event-sourcing/4-bootstrap.md b/docs/docs/event-sourcing/4-bootstrap.md index fb7eac34..a687a788 100644 --- a/docs/docs/event-sourcing/4-bootstrap.md +++ b/docs/docs/event-sourcing/4-bootstrap.md @@ -1,6 +1,5 @@ --- permalink: /docs/event-sourcing/bootstrap/ -redirect_from: /docs/getting-started/bootstrap/ title: Bootstrap alternate_title: Bootstrapping EventSauce --- diff --git a/docs/docs/getting-started/0-getting-started.md b/docs/docs/getting-started/0-getting-started.md new file mode 100644 index 00000000..c5a4131a --- /dev/null +++ b/docs/docs/getting-started/0-getting-started.md @@ -0,0 +1,29 @@ +--- +permalink: /docs/getting-started/introduction/ +redirect_from: /docs/getting-started/ +title: Getting Started +--- + +EventSauce is a pragmatic yet robust event sourcing library for PHP. At the heart of the library +are a set of simple interfaces that make it easy to adapt many types of infrastructure. A set of +ready-made components is there to speed up implementation. This guide will walk you through +the steps needed to set yourself up to start event sourcing. The guide will only focus on +what is relevant to setting up the library. Although there are some framework bindings available, +this guide will use a framework-agnostic point of view. You are expected to make the translation +on how to configure this in your framework of choice. + +In this guide we'll walk to initial setup, setting up tests for your aggregates, and wiring it +to infrastructure. Let's get started! + +## Installation + +To get started, first install EventSauce into your PHP project using +[composer](https://getcomposer.org). + +```bash +composer require eventsauce/eventsauce +``` + +This package contains the core of EventSauce, the interfaces, and generic tools. + +Next up, create your first [aggregate root](/docs/getting-started/create-aggregate-root/)! diff --git a/docs/docs/getting-started/1-create-your-aggregate-root.md b/docs/docs/getting-started/1-create-your-aggregate-root.md new file mode 100644 index 00000000..c2c49741 --- /dev/null +++ b/docs/docs/getting-started/1-create-your-aggregate-root.md @@ -0,0 +1,22 @@ +--- +permalink: /docs/getting-started/create-aggregate-root/ +title: Create an Aggregate Root +--- + +Our first step is to create an event-sourced aggregate root. This is the software model +we'll create that internally uses events. The aggregate root has functionality to rebuild +itself from stored events. It also has functionality to record and expose new events. + +EventSauce represents an aggregate root internally as an interface. Your model will be an +implementation of that interface. To make it easy, a default implementation is supplied in +the form of a trait, preventing you from having to write some boilerplate code. + +```php +use EventSauce\EventSourcing\AggregateRoot; +use EventSauce\EventSourcing\AggregateRootBehaviour; + +class YourAggregateRoot implements AggregateRoot +{ + use AggregateRootBehaviour; +} +```