PHPackages                             fdevs/moscow-open-data-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. fdevs/moscow-open-data-sdk

AbandonedArchivedLibrary[API Development](/categories/api)

fdevs/moscow-open-data-sdk
==========================

Moscow open data sdk: http://api.data.mos.ru

07PHP

Since Dec 10Pushed 11y ago4 watchersCompare

[ Source](https://github.com/4devs/moscow-open-data-sdk)[ Packagist](https://packagist.org/packages/fdevs/moscow-open-data-sdk)[ RSS](/packages/fdevs-moscow-open-data-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

\#Moscow Open Data SDK

This library allows easily work with [open data of Moscow government](http://data.mos.ru/). You can find a lot of useful data there, like: markets, sport object/zones, public transport ticket zones, schools, libraries and so on.

\##Installation Add `fdevs/moscow-open-data-sdk` as a dependency to your `composer.json` file:

```
php composer.phar require fdevs/moscow-open-data-sdk
```

\##Usage

\#####Example 1: Get list of all data types

Just create an instance of `OpenData` and feed it with `ClientInterface` instance and an api key you got [here](http://api.data.mos.ru/)

```
require __DIR__ . '/vendor/autoload.php';

use GuzzleHttp\Client;
use FDevs\MoscowOpenData\Api\OpenData;
use FDevs\MoscowOpenData\Model\DataType;
use FDevs\MoscowOpenData\Model\QueryFilter;

$apiKey = '12345...';
$api = new OpenData(new Client(), $apiKey);

// here you get a `Package` with `DataType` items inside
foreach ($api->getDataTypesList()->getItems() as $dataType) {
    /** @var DataType $dataType */
    printf(
        "id: %d\ncategory: %d\ndepartment: %d\ncaption: %s\n\n",
        $dataType->getId(),
        $dataType->getCategoryId(),
        $dataType->getDepartmentId(),
        $dataType->getCaption()
    );
}
```

When we get information this way, we have only information that is printed in the example above. Output:

```
...
id: 1534
category: 14
department: 6
caption: План обустройства территорий транспортно-пересадочных узлов в 2014 году

id: 912
category: 162
department: 16
caption: Места для пикника
...

```

\#####Example 2: Get full info about a data type

```
$dataTypeId = 912; // from previous example
$dataType = $api->getDataTypeFullInfo($dataTypeId);
```

Each data type may have own generic properties. Let's take a look:

```
echo $dataType->getDescription() . "\n";

foreach ($dataType->getGenericProperties() as $property) {
    /** @var GenericProperty $property */
    printf("type: %s, caption: %s\n", $property->getType(), $property->getCaption());
}
```

Output:

```
Места для пикника, расположенные в пределах установленных границ города Москвы
type: Photo, caption: Фотография
type: ObjectShortName, caption: Краткое название спортивного объекта
type: SportZoneName, caption: Название спортивной зоны
type: ObjectAdmArea, caption: Административный округ
type: ObjectDistrict, caption: Район
type: Address, caption: Адрес
type: Email, caption: Адрес электронной почты
type: WebSite, caption: Адрес сайта
type: HelpPhone, caption: Справочный телефон
...

```

\#####Example 3: Get data type entries (Sport zones in our case)

```
$sportZoneDataTypeId = 912;
$zones = $api->getDataTypeEntries($sportZoneDataTypeId);

foreach ($zones as $zone) {
    /** @var DataTypeEntry $zone */
    $website = $zone->hasGenericProperty('WebSite') ? $zone->getGenericProperty('WebSite')->getCaption() : '';
    $address = $zone->hasGenericProperty('Address') ? $zone->getGenericProperty('Address')->getCaption() : '';

    printf(
        "id: %s\nwebsite: %s\naddress: %s\n\n",
        $zone->getId(),
        $website,
        $address
    );
}
```

##### Filters

[](#filters)

It's possible to apply `Query` filter to some api calls. Check `OpenDataInterface` for more details.

\#####Example 4.1: Limit and offset

Query filter allows as to reduce a dataset and iterate through it.

```
$filter = new QueryFilter();
$filter
    ->setLimit(10)
    ->setSkip(5)
;
$dataPackage = $api->getDataTypesList($filter);
```

\#####Example 4.2: Inline count

It's possible to get a total records count using query filter:

```
$filter = new QueryFilter();
$filter
    ->setLimit(5)
    ->setShowInlineCount(true)
;
$dataPackage = $api->getDataTypesList($filter);

echo $dataPackage->getTotalCount();
```

\##More information Read the documentation of [Moscow open data](http://api.data.mos.ru/Docs)

\##License This library is licensed under the MIT license

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1994051?v=4)[Viktor Melnik](/maintainers/vmelnik-ukraine)[@vmelnik-ukraine](https://github.com/vmelnik-ukraine)

---

Top Contributors

[![vmelnik-ukraine](https://avatars.githubusercontent.com/u/1994051?v=4)](https://github.com/vmelnik-ukraine "vmelnik-ukraine (4 commits)")

### Embed Badge

![Health badge](/badges/fdevs-moscow-open-data-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/fdevs-moscow-open-data-sdk/health.svg)](https://phpackages.com/packages/fdevs-moscow-open-data-sdk)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
