reiterus/mcx-info-symfony

俄罗斯联邦农业部信息卡的 Symfony 组件

安装: 22

依赖项: 0

建议者: 0

安全: 0

星级: 3

关注者: 1

分支: 1

公开问题: 0

类型:symfony-bundle

3.0.0 2023-04-02 04:21 UTC

This package is auto-updated.

Last update: 2024-10-01 00:09:05 UTC


README

俄罗斯联邦农业部作为 Symfony 组件的 REST API URL(响应为 json 格式)的总结信息。

默认 URL: /bundle/mcx/info/index

所有数据均来自部公开互联网资源。

screenshot from the website Agriculture Ministry

部分响应内容可被操作

  • 主要数据(主要):标题、地址、网站等
  • 部官员(人物)
  • 联系信息

app 目录中包含可用于使用的文件,需要将其移动到项目中的相应目录,这将导致默认信息的完成。

响应

输出可以以两种格式显示

  • 一行显示
  • 格式化美观
{
    "title": "Министерство сельского хозяйства Российской Федерации",
    "description": "Федеральный орган исполнительной власти...",
    "address": "107996, Москва, Орликов переулок, 1\/11",
    "site": "https:\/\/mcx.gov.ru",
    "contacts": [
        "Тел.: +7 (495) 607-80-00",
        "Факс: +7 (495) 607-83-62",
        "info@mcx.gov.ru"
    ],
    "persons": [
        [
            "Патрушев Дмитрий Николаевич",
            "Министр сельского хозяйства Российской Федерации",
            "info@mcx.gov.ru",
            "Тел.: +7 (495) 607-80-00",
            "Факс: +7 (495) 607-83-62"
        ],
        [
          "..."
        ]
    ]
}

用法

URL 设置

# connecting config with route
reiterus_mcx_info:
  resource: '@McxInfoBundle/Resources/config/routes.xml'
  prefix: /bundle/mcx/info

包设置

# adding contacts and formatting the output
reiterus_mcx_info:
    contacts:
        - 'Тел.: +7 (495) 607-80-00'
        - 'Факс: +7 (495) 607-83-62'
        - 'info@mcx.gov.ru'
    pretty: true

# addition of personalities through a service with a specific tag
services:
    app.reiterus_mcx_info_persons:
        class: App\Util\McxPersons
        tags:
            - { name: 'tag_mcx_info_persons' }

安装

您可以通过两种方式安装此组件

从 packagist.org

composer require reiterus/mcx-info-symfony

从 GitHub 仓库

{
 "repositories": [
  {
   "type": "vcs",
   "url": "https://github.com/reiterus/mcx-info-symfony.git"
  }
 ]
}

测试

要运行带有视觉覆盖率的测试,请按以下命令启动

XDEBUG_MODE=coverage ./vendor/phpunit/phpunit/phpunit \
--configuration phpunit.xml \
--testsuite default \
--coverage-html coverage/

测试结果将保存到 coverage 目录。

Coverage

提示: vendor/bin/phpunit --generate-configuration

许可证

此库在 MIT 许可证 下发布。