PHPackages                             addon/kodifikator - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. addon/kodifikator

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

addon/kodifikator
=================

Parser and importer for the Ukrainian Codifier of Administrative-Territorial Units

v1.0.1(1y ago)02CC-BY-4.0PHPPHP ^8.1

Since Jun 26Pushed 1mo agoCompare

[ Source](https://github.com/testapiw/kodifikator)[ Packagist](https://packagist.org/packages/addon/kodifikator)[ RSS](/packages/addon-kodifikator/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (4)Versions (3)Used By (0)

🇺🇦 Kodifikator Parser &amp; Importer
====================================

[](#-kodifikator-parser--importer)

**Parser and importer for the Codifier of Administrative-Territorial Units and Territorial Communities of Ukraine.**

This Symfony-based project automates the process of parsing, downloading, and importing the official Ukrainian
**Кодифікатор адміністративно-територіальних одиниць та територій територіальних громад КАТОТТГ**
into your application.

---

Source
------

[](#source)

**Official government page:**
🔗 [mindev.gov.ua](https://mindev.gov.ua/diialnist/rozvytok-mistsevoho-samovriaduvannia/kodyfikator-administratyvno-terytorialnykh-odynyts-ta-terytorii-terytorialnykh-hromad)

**License:** [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/deed.en)

---

Features
--------

[](#features)

- Automatically parses the latest codifier release from the official site.
- Downloads and stores XLSX, PDF, DOCX versions of the document.
- **\[NEW\]** Supports **local offline import** for cases when the remote server is unavailable or custom historical files are required.
- Imports XLSX data into your database using Doctrine.
- Batch processing for optimized performance with large datasets.
- Symfony Console command and HTTP API endpoints available.

---

Requirements
------------

[](#requirements)

### PHP Extensions

[](#php-extensions)

- `php-gd`
- `php-zip`
- `php-xml`
- `php-mbstring`

### Composer Dependencies

[](#composer-dependencies)

```
composer require guzzlehttp/guzzle
composer require symfony/dom-crawler symfony/css-selector
composer require phpoffice/phpspreadsheet
```

---

Installation
------------

[](#installation)

1. Clone the repository
2. Set the environment variable for storage:

```
# .env
KODIFIKATOR_PATH="var/kodifikator"
```

3. Register services in config/services.yaml

```
services:
    # Automatically register Doctrine repositories
    Kodifikator\Repository\:
        resource: '../addon/kodifikator/src/Repository'
        tags: ['doctrine.repository_service']

    # Register services with parameters
    Kodifikator\Service\KodifikatorUploader:
        arguments:
            $storagePath: '%env(resolve:KODIFIKATOR_PATH)%'

    Kodifikator\Service\KodifikatorImport:
        arguments:
            $storagePath: '%env(resolve:KODIFIKATOR_PATH)%'

    # Explicitly register the local importer service
    Kodifikator\Service\KodifikatorLocalImporter: ~

    Kodifikator\Domain\KodifikatorParser: ~

    Kodifikator\Service\KodifikatorManager: ~

    # Autowire other classes (e.g., Console, Controller, etc.)
    Kodifikator\:
        resource: '%kernel.project_dir%/vendor/addon/kodifikator/src/Repository'
        exclude:
            - '%kernel.project_dir%/vendor/addon/kodifikator/src/Entity'
            - '%kernel.project_dir%/vendor/addon/kodifikator/src/Repository'

    # Register local import command with arguments
    App\Utility\Kodifikator\Command\KodifikatorImportLocalCommand:
        arguments:
            $localImporter: '@Kodifikator\Service\KodifikatorLocalImporter'
            $storagePath: '%env(resolve:KODIFIKATOR_PATH)%'
```

3. Register Doctrine mapping in config/packages/doctrine.yaml:

```
doctrine:
    orm:
        mappings:
            Kodifikator:
                is_bundle: false
                type: attribute
                dir:  '%kernel.project_dir%/vendor/addon/kodifikator/src/Entity'
                prefix: 'Kodifikator\Entity'
                alias: Kodifikator
```

```
php bin/console make:migration

```

4. Ensure the storage directory exists and is writable:

```
sudo mkdir -p var/kodifikator
sudo chown www-data:www-data var/kodifikator
```

Install via Composer:

```
composer require addon/kodifikator
```

---

Usage
-----

[](#usage)

### Remote Mode (Automatic)

[](#remote-mode-automatic)

Run the full fetch and import process via Symfony Console:

```
php bin/console kodifikator:update
```

Or call via HTTP API (if exposed):

```
GET  /kodifikator/parse     # Get available document links
POST /kodifikator/update    # Run full fetch & import process
```

### Local Mode (Offline/Manual)

[](#local-mode-offlinemanual)

To import a specific XLSX file already located in the var/kodifikator/ directory without making HTTP requests to external servers:

```
php bin/console kodifikator:import-local [filename] "[publication_date_or_title]"
```

Example:
========

[](#example)

```
php bin/console kodifikator:import-local kodifikator-22-06-2026.xlsx "Кодифікатор 22.06.2026"
```

---

Optimization Notes
------------------

[](#optimization-notes)

This project handles large XLSX datasets efficiently:

- **Batch inserts:** Processes 300 rows at a time
- **Hash upsert:** Prevents duplicates using computed hash key
- **Streaming:** XLSX rows are processed with minimal memory

Supports large files with 30,000+ rows.

---

Structure
---------

[](#structure)

ComponentDescription`KodifikatorParser`Parses the official government page`KodifikatorUploader`Downloads XLSX/PDF/DOCX files and stores metadata`KodifikatorImport`Reads and imports XLSX content into the database`KodifikatorLocalImporter`Emulates upload metadata and directly triggers the XLSX import pipeline for local files`KodifikatorController`Optional API interface for triggering actions`KodifikatorUpdateCommand`Symfony Console command for full update---

License
-------

[](#license)

This project uses publicly available government data under the
[Creative Commons Attribution 4.0 International License (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/deed.en).

Changelog
---------

[](#changelog)

\[2026-07-04\] - Local File Processing Implementation

### Added

[](#added)

KodifikatorLocalImporter service: Developed to mock the application registry state for local files. It injects a virtual record into the local documents database, skipping the external parsing/download pipeline while seamlessly redirecting execution to the primary high-performance core parsing system (KodifikatorImport).

KodifikatorImportLocalCommand Symfony command: Created a flexible CLI tool (kodifikator:import-local) accepting localized targets and descriptive metadata arguments, complete with localized (Ukrainian) configuration hints.

### Why these changes were introduced

[](#why-these-changes-were-introduced)

Previously, the module strictly depended on a live connection to the official government website (mindev.gov.ua), making the initial staging deployment or localized development tasks fragile if remote resources were temporarily unreachable or structured differently.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance71

Regular maintenance activity

Popularity2

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

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.

###  Release Activity

Cadence

Every ~4 days

Total

2

Last Release

413d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7a64e32972552f929e57aebd497175b99b06c981ade505731240aeb8f9681139?d=identicon)[testapiw](/maintainers/testapiw)

### Embed Badge

![Health badge](/badges/addon-kodifikator/health.svg)

```
[![Health](https://phpackages.com/badges/addon-kodifikator/health.svg)](https://phpackages.com/packages/addon-kodifikator)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.7M3.4k](/packages/craftcms-cms)[spatie/crawler

Crawl all internal links found on a website

2.8k19.3M74](/packages/spatie-crawler)[sproutcms/cms

Enterprise content management and framework

243.0k4](/packages/sproutcms-cms)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

762297.9k53](/packages/civicrm-civicrm-core)[drupal/core-dev

require-dev dependencies from drupal/drupal; use in addition to drupal/core-recommended to run tests from drupal/core.

2023.2M367](/packages/drupal-core-dev)[spatie/laravel-export

Create a static site bundle from a Laravel app

679153.2k7](/packages/spatie-laravel-export)

PHPackages © 2026

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