PHPackages                             flux-eco/projection - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. flux-eco/projection

ActiveFlux-app[Utility &amp; Helpers](/categories/utility)

flux-eco/projection
===================

Creates projections of aggregate root objects

1.7.0(4y ago)0532GPL-3.0-onlyPHPPHP &gt;=8.0

Since Apr 2Pushed 4y agoCompare

[ Source](https://github.com/flux-eco/projection)[ Packagist](https://packagist.org/packages/flux-eco/projection)[ Docs](https://fluxlabs.ch)[ RSS](/packages/flux-eco-projection/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (9)Dependencies (13)Versions (10)Used By (2)

flux-eco/projection
===================

[](#flux-ecoprojection)

This component is responsible for projections of aggregate root objects. The projections are described as json schemas.

Usage
-----

[](#usage)

.env

```
PROJECTION_APP_SCHEMA_DIRECTORY=../schemas
PROJECTION_ECO_SCHEMA_DIRECTORY=schemas/projections
PROJECTION_STORAGE_CONFIG_ENV_PREFIX=PROJECTION_
PROJECTION_STORAGE_NAME=projection
PROJECTION_STORAGE_HOST=localhost
PROJECTION_STORAGE_DRIVER=Pdo_Mysql
PROJECTION_STORAGE_USER=user
PROJECTION_STORAGE_PASSWORD=password
STREAM_STORAGE_CONFIG_ENV_PREFIX=STREAM_
STREAM_STORAGE_NAME=stream
STREAM_STORAGE_HOST=localhost
STREAM_STORAGE_DRIVER=Pdo_Mysql
STREAM_STORAGE_USER=user
STREAM_STORAGE_PASSWORD=password
STREAM_TABLE_NAME=stream
STREAM_STATE_SCHEMA_FILE=../vendor/flux-eco/global-stream/schemas/State.yaml

```

schemas\\domain\\account.yaml

```
title: account
type: object
properties:
    aggregateId:
        type: string
        readOnly: true
    correlationId:
        type: string
        readOnly: true
    aggregateName:
        type: string
        const: todo
        readOnly: true
    sequence:
        type: integer
        readOnly: true
    createdDateTime:
        type: string
        format: date-time
        readOnly: true
    createdBy:
        type: string
        format: email
        readOnly: true
    changedDateTime:
        type: string
        format: date-time
        readOnly: true
    changedBy:
        type: string
        format: email
        readOnly: true
    rootObjectSchema:
        type: string
        const: v1
    rootObject:
        type: object
        properties:
            firstname:
                type: string
            lastname:
                type: string

```

schemas\\projections\\account.yaml

```
title: account
type: object
aggregateRootNames:
  - account
properties:
  projectionId:
    type: string
  firstname:
    type: string
    index: account.rootObject.firstname
  lastname:
    type: string
    index: account.rootObject.lastname

```

example.php

```
