ellinaut/com-view-server-bundle

为 eos/com-view-server 提供的 Symfony 集成

安装: 504

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 0

分支: 1

类型:symfony-bundle

1.0.0 2021-12-13 13:23 UTC

This package is auto-updated.

Last update: 2024-09-13 19:44:32 UTC


README

eos/com-view-server提供 Symfony 集成

替换不再维护的 eos/com-view-server-bundle

安装

composer require ellinaut/com-view-server-bundle

配置

创建文件 config/packages/eos_com_view_server.yaml,内容如下

eos_com_view_server:
    allow_origin: '*' # cors control; * is the default value
    schema: # the definition which will be available as /cv/schema.json
        headers:
            authorization:
                description: 'Authorization header'
        views:
            exampleView:
                description: 'Example view'
                data:
                    success: 'exampleSchema'
        commands:
            exampleCommands:
                description: 'Example command'
        schemas:
            exampleSchema:
                description: 'Example schema'
                properties:
                    example:
                        description: 'Example property'
                        type: 'string'

使用以下配置你的 config/routes.yaml

eos_com_view:
    resource: '@EosComViewServerBundle/Resources/config/routes.xml'

命令

命令(实现 Eos\ComView\Server\Command\CommandProcessorInterface 的类)可以通过在 config/services.yaml 中使用服务标签 com_view.command_processor 进行注册

services:
    # with "command", if class name is not equal to command name 
    YourCommand\CommandProcessor:
        tags:
            - { name: 'com_view.command_processor', command: 'executeYourCommand' } 

    # without "command", if class name is equal to command name (in this example the command name must be "executeSecondCommand")
    YourCommand\ExecuteSecondCommand:
        tags:
            - { name: 'com_view.command_processor' }

视图

视图(实现 Eos\ComView\Server\View\ViewInterface 的类)可以通过在 config/services.yaml 中使用服务标签 com_view.view 进行注册

services:
    # with "view", if class name is not equal to view name 
    YourView\TestView:
        tags:
            - { name: 'com_view.view', view: 'showTest' } 

    # without "view", if class name is equal to view name (in this example the view name must be "showExample")
    YourView\ShowExample:
        tags:
            - { name: 'com_view.view' }

健康提供者

健康提供者(实现 Eos\ComView\Server\Health\ViewHealthProviderInterfaceEos\ComView\Server\Health\CommandHealthProviderInterface 的类)可以通过在 config/services.yaml 中使用服务标签 com_view.health_provider 进行注册

services:
    YourHealthProvider\TestProvider:
        tags:
            - { name: 'com_view.health_provider' } 

头部信息

此包会将头部名称转换为小写!