borisey / yii2-regulation-client
Yii2 regulation
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/borisey/yii2-regulation-client
Requires
- ext-curl: *
- ext-json: *
This package is auto-updated.
Last update: 2026-01-13 09:45:20 UTC
README
Non-official PHP/Yii2 package for regulation.gov.ru REST API
- Official project site: https://regulation.gov.ru
- Open data passport: https://regulation.gov.ru/opendata/7710349494-npalist/
- Data owner: Ministry of Economic Development of Russia
Quickstart
Installation
The package can be installed via Composer:
composer require borisey/yii2-regulation-client:"dev-main" --dev
Configuration
Add component to: config/web.php
'components' => [ ... 'regulation' => [ 'class' => \Borisey\Yii2RegulationClient\Regulation::class, 'format' => 'json', // 'json' or 'xml' ], ... ],
Usage
$regulation = \Yii::$app->regulation; $doc = $regulation->getById(5386); echo '<pre>'; print_r($doc); echo '</pre>'; $regulation = \Yii::$app->regulation; $docs = $regulation->getByParams([ 'limit' => 50, 'fields' => 'title,projectId,date', 'sort' => 'desc' ]); echo '<pre>'; print_r($docs); echo '</pre>';
Parameters for getByParams
The method accepts an associative array with the following keys:
| Parameter | Type | Default | Description | Notes |
|---|---|---|---|---|
| limit | integer | null | Maximum number of documents to fetch | Must be positive. |
| offset | integer | null | Number of documents to skip | Useful for pagination. |
| fields | string | null | Comma-separated list of fields to return | Only allowed fields; invalid fields throw an exception. |
| search | string | null | Search string to filter documents | Partial match supported. |
| sort | string | null | Sort order | Only "desc" is allowed. |
Allowed Fields
You can pass a comma-separated list of the following fields in the fields parameter:
title, projectId, date, stage, status, department, procedure, problem, objectives, responsible, circlePersons, socialRelations, rationale, planDate, transitionPeriod, regulatoryImpact, procedureStartDate, procedureEndDate, procedureResult, parallelStageFile, parallelStageStartDiscussion, parallelStageEndDiscussion, compliteNumberDepAct, compliteDateAct, compliteNumberRegAct, nextStageDuration, startDiscussion, endDiscussion, discussionDays
Notes
- The fields parameter accepts a comma-separated list of allowed fields. Invalid fields will throw an exception.
- The sort parameter can only be "desc" or omitted.
- You can pass only the parameters you need — no need to set others to null.
License
This software is made available by Alexey Borisov under the MIT license.
Yii2 клиент для работы с API regulation.gov.ru
Неофициальный PHP/Yii2 пакет для REST API сайта regulation.gov.ru
- Официальный сайт проекта: https://regulation.gov.ru
- Паспорт открытых данных: https://regulation.gov.ru/opendata/7710349494-npalist/
- Владелец набора данных: Минэкономразвития России
Быстрый старт
Установка
Пакет можно установить через Composer:
composer require borisey/yii2-regulation-client:"dev-main" --dev
Настройка
Добавьте компонент в config/web.php:
'components' => [ // ... 'regulation' => [ 'class' => \Borisey\Yii2RegulationClient\Regulation::class, 'format' => 'json', // 'json' или 'xml' ], // ... ],
Использование
$regulation = \Yii::$app->regulation; // Получение одного документа по ID $doc = $regulation->getById(5386); echo '<pre>'; print_r($doc); echo '</pre>'; // Получение документов по параметрам $docs = $regulation->getByParams([ 'limit' => 50, 'fields' => 'title,projectId,date', 'sort' => 'desc' ]); echo '<pre>'; print_r($docs); echo '</pre>';
Параметры метода getByParams
| Параметр | Тип | По умолчанию | Описание | Примечания |
|---|---|---|---|---|
| limit | integer | null | Максимальное количество документов для получения | Должно быть положительным |
| offset | integer | null | Количество пропускаемых документов | Используется для пагинации |
| fields | string | null | Список допустимых полей через запятую для возврата | Недопустимые поля вызовут исключение |
| search | string | null | Строка для поиска документов | Поддерживается частичное совпадение |
| sort | string | null | Порядок сортировки | Допустимо только "desc" |
Допустимые поля
В параметре fields можно передавать список следующих полей через запятую:
title, projectId, date, stage, status, department, procedure, problem, objectives, responsible, circlePersons, socialRelations, rationale, planDate, transitionPeriod, regulatoryImpact, procedureStartDate, procedureEndDate, procedureResult, parallelStageFile, parallelStageStartDiscussion, parallelStageEndDiscussion, compliteNumberDepAct, compliteDateAct, compliteNumberRegAct, nextStageDuration, startDiscussion, endDiscussion, discussionDays
Примечания
- Параметр fields принимает список допустимых полей через запятую. Недопустимые поля вызовут исключение.
- Параметр sort может быть только "desc" или отсутствовать.
- Можно передавать только нужные параметры — не нужно указывать null для остальных.
Лицензия
This software is made available by Alexey Borisov under the MIT license.