mcx-info-symfony

Information card of the Russian Federation Agriculture Ministry as Symfony Bundle

MIT License

Downloads
22
Stars
3
Committers
1

Card of the Russia Agriculture Ministry

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.

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",
        "[email protected]"
    ],
    "persons": [
        [
            "Патрушев Дмитрий Николаевич",
            "Министр сельского хозяйства Российской Федерации",
            "[email protected]",
            "Тел.: +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'
        - '[email protected]'
    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.

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

License

This library is released under the MIT license.

Package Rankings
Top 31.03% on Packagist.org
Badges
Extracted from project README
screenshot from the website Agriculture Ministry
Related Projects