reiterus/mcx-info-symfony

Information card of the Russian Federation Agriculture Ministry as Symfony Bundle

Installs: 23

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 1

Forks: 1

Open Issues: 0

Type:symfony-bundle

3.0.0 2023-04-02 04:21 UTC

This package is auto-updated.

Last update: 2025-05-29 01:38:22 UTC


README

Summary information on the Ministry of Agriculture of the Russian Federation as a Symfony bundle that provides a REST API URL with response in json format.

Default URL: /bundle/mcx/info/index

All data was obtained from the public Internet resource of the ministry.

screenshot from the website Agriculture Ministry

Some of the response content can be manipulated:

  • main data (main): title, address, site, etc
  • officials of the ministry (persons)
  • contacts

The app directory contains ready-to-use files, which need to be moved to the appropriate directories your project, which will lead to the completion of the default information.

Response

The output can be show in two formats:

  • in one line
  • beautifully formatted
{
    "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"
        ],
        [
          "..."
        ]
    ]
}

Usage

URL setting

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

Package setup

# 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' }

Installation

You can install the bundle in two ways

From packagist.org

composer require reiterus/mcx-info-symfony

From GitHub repository

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

Tests

To run tests with visual code coverage, launch the command as follows:

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

Test results will be saved in the coverage directory.

Coverage

Tip: vendor/bin/phpunit --generate-configuration

License

This library is released under the MIT license.