定制 flux-eco/api-gateway-event-sourced-app 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

flux-eco/api-gateway-event-sourced-app

Composer 安装命令:

composer require flux-eco/api-gateway-event-sourced-app

包简介

Manage requests from outside for an event sourced application

README 文档

README

Manage all requests from outside for an event sourced application. Up to now this component is binded to the other flux-eco components. You can bind your own components by implementing an adapter and exchange the Adapters\Configs\Outbound class.

The following example application demonstrates the usage: https://github.com/flux-caps/todo-app

Usage

.env

AGGREGATE_ROOT_SCHEMA_DIRECTORY=schemas/domain
AGGREGATE_ROOT_STORAGE_CONFIG_ENV_PREFIX=EVENTS_
AGGREGATE_ROOT_EVENT_SCHEMA_FILE_PATH=../vendor/flux-eco/aggregate-root/schemas/AggregateRootEvent.yaml
EVENTS_STORAGE_HOST=localhost
EVENTS_STORAGE_DRIVER=Pdo_Mysql
EVENTS_STORAGE_NAME=events
EVENTS_STORAGE_USER=user
EVENTS_STORAGE_PASSWORD=password
PROJECTION_APP_SCHEMA_DIRECTORY=../vendor/flux-eco/projection/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
UI_TRANSFORM_TRANSLATION_FILES_DIRECTORY=configs/translations
UI_TRANSFORM_UI_DEFINITION_DIRECTORY=configs/ui
UI_TRANSFORM_PAGE_LIST_DEFINITION_FILE_PATH=configs/ui/pages.yaml
UI_TRANSFORM_MARKDOWN_TO_HTML_CONVERTER_REST_API_URL=http://localhost:9001

schemas and configs

@see examples/schemas and examples/configs

example.php

<?php

require_once __DIR__ . '/../vendor/autoload.php';

FluxEco\DotEnv\Api::new()->load(__DIR__);

//initialize
fluxApiGatewayEventSourcedApp\initialize();


//create item
$correlationId = fluxValueObject\getNewUuid();
$actorEmail = 'example@fluxlabs.ch';
$requestUri = '/api/v1/command/account/createItem';
$projectionKeyValueData = [
    "firstname" => "Emmett",
    "lastname" => "Brown"
];
fluxApiGatewayEventSourcedApp\command($correlationId, $actorEmail, $requestUri, $projectionKeyValueData);
echo '/api/v1/command/account/createItem handled '.PHP_EOL.PHP_EOL;


//get item list
$requestUri = '/api/v1/query/account/getItemList';
$itemList = fluxApiGatewayEventSourcedApp\query($correlationId, $actorEmail, $requestUri, []);
echo '/api/v1/query/{projectionName}/getItemList handled: '.PHP_EOL;
print_r($itemList);
echo PHP_EOL.PHP_EOL;


//change item
$correlationId = fluxValueObject\getNewUuid();
$projectionId = $itemList['data'][0]['projectionId'];
$projectionKeyValueData = [
    "firstname" => "Dr. Emmett",
    "lastname" => "Brown"
];
$requestUri = '/api/v1/command/account/item/'.$projectionId.'/updateItem';
fluxApiGatewayEventSourcedApp\command($correlationId, $actorEmail, $requestUri, $projectionKeyValueData);
echo '/api/v1/command/{projectionName}/item/{projectionId}/updateItem handled: '.PHP_EOL.PHP_EOL;


//get item
$requestUri = '/api/v1/query/account/item/'.$projectionId.'/getItem';
$item = fluxApiGatewayEventSourcedApp\query($correlationId, $actorEmail, $requestUri, []);
echo '/api/v1/query/{projectionName}/item/{projectionId}/getItem handeld: '.PHP_EOL.PHP_EOL;
print_r($item);
echo PHP_EOL.PHP_EOL;


//delete item
$requestUri = '/api/v1/command/account/item/'.$projectionId.'/deleteItem';
fluxApiGatewayEventSourcedApp\command($correlationId, $actorEmail, $requestUri, []);
echo '/api/v1/command/{projectionName}/item/{projectionId}/deleteItem handeld: '.PHP_EOL.PHP_EOL;


//get page list
$requestUri = '/api/v1/query/getPageList';
$pageList = fluxApiGatewayEventSourcedApp\query($correlationId, $actorEmail, $requestUri, []);
echo '/api/v1/query/getPageList handeld: '.PHP_EOL.PHP_EOL;
print_r($pageList);


//get page
$requestUri = '/api/v1/query/account/getPage';
$page = fluxApiGatewayEventSourcedApp\query($correlationId, $actorEmail, $requestUri, []);
echo '/api/v1/query/getPage handeld: '.PHP_EOL.PHP_EOL;
print_r($page);

outputs

/api/v1/command/account/createItem handled 

/api/v1/query/{projectionName}/getItemList handled: 
Array
(
    [data] => Array
        (
            [0] => Array
                (
                    [projectionId] => 6229121e-e5d5-4ada-9fb2-01b579adea2f
                    [firstname] => Emmett
                    [lastname] => Brown
                )
        )

    [status] => success
    [total] => 1
)


/api/v1/command/{projectionName}/item/{projectionId}/updateItem handled: 

/api/v1/query/{projectionName}/item/{projectionId}/getItem handeld: 

Array
(
    [projectionId] => 6229121e-e5d5-4ada-9fb2-01b579adea2f
    [firstname] => Dr. Emmett
    [lastname] => Brown
)


/api/v1/command/{projectionName}/item/{projectionId}/deleteItem handeld: 

/api/v1/query/getPageList handeld: 

Array
(
    [data] => Array
        (
            [0] => Array
                (
                    [title] => Account
                    [url] => /listdata/Topic
                    [avatar] => /icons/seminars.png
                    [pageType] => ListData
                    [projectionName] => account
                    [editForm] => Array
                        (
                            [properties] => Array
                                (
                                    [0] => Array
                                        (
                                            [title] => Firstname
                                            [key] => firstname
                                            [dataIndex] => firstname
                                            [valueType] => string
                                            [width] => m
                                            [formItemProps] => Array
                                                (
                                                    [rules] => Array
                                                        (
                                                            [0] => Array
                                                                (
                                                                    [required] => 1
                                                                    [message] => Please enter a firstname
                                                                )

                                                        )

                                                )

                                        )

                                    [1] => Array
                                        (
                                            [title] => Lastname
                                            [key] => lastname
                                            [dataIndex] => lastname
                                            [valueType] => string
                                            [width] => m
                                            [formItemProps] => Array
                                                (
                                                )

                                        )

                                )

                        )

                    [createForm] => Array
                        (
                            [properties] => Array
                                (
                                    [0] => Array
                                        (
                                            [title] => Firstname
                                            [key] => firstname
                                            [dataIndex] => firstname
                                            [valueType] => string
                                            [width] => m
                                            [formItemProps] => Array
                                                (
                                                    [rules] => Array
                                                        (
                                                            [0] => Array
                                                                (
                                                                    [required] => 1
                                                                    [message] => Please enter a firstname
                                                                )

                                                        )

                                                )

                                        )

                                    [1] => Array
                                        (
                                            [title] => Lastname
                                            [key] => lastname
                                            [dataIndex] => lastname
                                            [valueType] => string
                                            [width] => m
                                            [formItemProps] => Array
                                                (
                                                )

                                        )

                                )

                        )

                    [itemActions] => Array
                        (
                            [edit] => Array
                                (
                                    [type] => form
                                    [key] => editForm
                                    [title] => edit
                                )

                            [delete] => Array
                                (
                                    [type] => form
                                    [key] => deleteForm
                                    [title] => delete
                                )

                        )

                )

        )

    [status] => success
    [total] => 1
)
/api/v1/query/getPage handeld: 

Array
(
    [title] => Account
    [url] => /listdata/Topic
    [avatar] => /icons/seminars.png
    [pageType] => ListData
    [projectionName] => account
    [editForm] => Array
        (
            [properties] => Array
                (
                    [0] => Array
                        (
                            [title] => Firstname
                            [key] => firstname
                            [dataIndex] => firstname
                            [valueType] => string
                            [width] => m
                            [formItemProps] => Array
                                (
                                    [rules] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [required] => 1
                                                    [message] => Please enter a firstname
                                                )

                                        )

                                )

                        )

                    [1] => Array
                        (
                            [title] => Lastname
                            [key] => lastname
                            [dataIndex] => lastname
                            [valueType] => string
                            [width] => m
                            [formItemProps] => Array
                                (
                                )

                        )

                )

        )

    [createForm] => Array
        (
            [properties] => Array
                (
                    [0] => Array
                        (
                            [title] => Firstname
                            [key] => firstname
                            [dataIndex] => firstname
                            [valueType] => string
                            [width] => m
                            [formItemProps] => Array
                                (
                                    [rules] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [required] => 1
                                                    [message] => Please enter a firstname
                                                )

                                        )

                                )

                        )

                    [1] => Array
                        (
                            [title] => Lastname
                            [key] => lastname
                            [dataIndex] => lastname
                            [valueType] => string
                            [width] => m
                            [formItemProps] => Array
                                (
                                )

                        )

                )

        )

    [itemActions] => Array
        (
            [edit] => Array
                (
                    [type] => form
                    [key] => editForm
                    [title] => edit
                )

            [delete] => Array
                (
                    [type] => form
                    [key] => deleteForm
                    [title] => delete
                )

        )

)

Contributing 💜

Please ...

  1. ... register an account at https://git.fluxlabs.ch
  2. ... create pull requests 🔥

Adjustment suggestions / bug reporting 🐾

Please ...

  1. ... register an account at https://git.fluxlabs.ch
  2. ... ask us for a Service Level Agreement: support@fluxlabs.ch 😘
  3. ... read and create issues

flux-eco/api-gateway-event-sourced-app 适用场景与选型建议

flux-eco/api-gateway-event-sourced-app 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 03 月 27 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「flux-eco」 「fluxlabs」 「api-gateway-event-sourced-app」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 flux-eco/api-gateway-event-sourced-app 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 flux-eco/api-gateway-event-sourced-app 我们能提供哪些服务?
定制开发 / 二次开发

基于 flux-eco/api-gateway-event-sourced-app 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 24
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-only
  • 更新时间: 2022-03-27