PHPackages                             koren-software/ehak-locations - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. koren-software/ehak-locations

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

koren-software/ehak-locations
=============================

PHP Library to convert location into EHAK classification code and vice-versa

1.11.0(2mo ago)29.3k↓11.5%2MITPHPPHP &gt;=7.4CI passing

Since Nov 5Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/koren-software/ehak-locations-php)[ Packagist](https://packagist.org/packages/koren-software/ehak-locations)[ RSS](/packages/koren-software-ehak-locations/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (10)Versions (19)Used By (0)

[![Actions Status](https://github.com/koren-software/ehak-locations-php/workflows/build/badge.svg)](https://github.com/koren-software/ehak-locations-php/actions)[![Latest Stable Version](https://camo.githubusercontent.com/2d8b2e68e2af37206ffa3d4a7ae27b365fd5136a92028a810ab4ae8190202145/68747470733a2f2f706f7365722e707567782e6f72672f6b6f72656e2d736f6674776172652f6568616b2d6c6f636174696f6e732f762f737461626c65)](https://packagist.org/packages/koren-software/ehak-locations)[![Total Downloads](https://camo.githubusercontent.com/cf46c26287e7fce535a96475069af0297c9d1051ff5f84ff71c55b785fcc898c/68747470733a2f2f706f7365722e707567782e6f72672f6b6f72656e2d736f6674776172652f6568616b2d6c6f636174696f6e732f646f776e6c6f616473)](https://packagist.org/packages/koren-software/ehak-locations)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

EHAK Locations
==============

[](#ehak-locations)

> PHP Library to convert location into EHAK classification code and vice-versa

Install
=======

[](#install)

```
composer require koren-software/ehak-locations
```

Usage
-----

[](#usage)

```
use \Koren\EHAK\EHAK;

$ehak = new EHAK(); // init EHAK instance on latest data

// Get EHAK code from location
$countyCode = $ehak->getCode(EHAK::COUNTIES, 'EST', 'Harju maakond'); // 0037

$cityCode = $ehak->getCode(EHAK::CITIES, $countyCode, 'Tallinn'); // 0784
$ehak->getCode(EHAK::CITY_DISTRICTS, $cityCode, 'Haabersti linnaosa'); // 0176

$parishCode = $ehak->getCode(EHAK::PARISHES, $countyCode, 'Anija vald'); // 0141
$ehak->getCode(EHAK::VILLAGES, $parishCode, 'Aegviidu alev'); // 1086

// Get EHAK location from code
$ehak->getLocation(EHAK::COUNTIES, 'EST', '0037'); // Harju maakond

$ehak->getLocation(EHAK::CITIES, '0037', '0784'); // Tallinn
$ehak->getLocation(EHAK::CITY_DISTRICTS, '0784', '0176'); // Haabersti linnaosa

$ehak->getLocation(EHAK::PARISHES, '0037', '0141'); // Anija vald
$ehak->getLocation(EHAK::VILLAGES, '0141', '1086'); // Aegviidu alev

// Get full location from EHAK code
$ehak->getFullLocation('0176');

//Gives:
[
    'counties' => 'Harju maakond',
    'cities' => 'Tallinn',
    'city_districts' => 'Haabersti linnaosa',
    'parishes' => '',
    'villages' => '',
]

// Get code from full location
$ehak->getCodeFromFullLocation([
    EHAK::COUNTIES => 'Harju maakond',
    EHAK::CITIES => 'Tallinn',
    EHAK::CITY_DISTRICTS => 'Haabersti linnaosa',
    EHAK::PARISHES => '',
    EHAK::VILLAGES => '',
]); // 0176
```

Development
-----------

[](#development)

### Update data

[](#update-data)

`src/data` directory holds different versions of EHAK data. To save new version or update old, run:

```
# If you have XLSX with headers like "Kood", "Nimi" etc
bin/update.php --path "EHAK XLSX PATH HERE, e.g /path/to/EHAK2023v3_veebifail.xlsx"
# If you have XLSX with headers like "Value", "Label-et-EE" etc
bin/update-with-value-headers.php --path "EHAK XLSX PATH HERE, e.g /path/to/EHAK2023v3_veebifail.xlsx"
```

NB! XLSX should be downloaded from Content &gt; Downloads tab. Download file which contains "veebifail" in it's name.

#### Options

[](#options)

- `--version="VERSION"` / `-v VERSION` - override EHAK version (if filename doesn't match `YYYYvN` pattern)
- `--output="FILENAME"` / `-o FILENAME` - set different output destination
- `--debug` / `-d` - enable debug

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance88

Actively maintained with recent releases

Popularity29

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 90.4% 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.

###  Release Activity

Cadence

Every ~153 days

Recently: every ~262 days

Total

16

Last Release

77d ago

PHP version history (3 changes)1.0.0PHP ^7.2

1.6.0PHP ^7.2|^8.0

1.8.0PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/2300b3392c5534fe07c444ba2a0b3e12f745265a76683dbf8e61691032acb7a8?d=identicon)[renekorss](/maintainers/renekorss)

---

Top Contributors

[![renekorss](https://avatars.githubusercontent.com/u/1494080?v=4)](https://github.com/renekorss "renekorss (66 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")

---

Tags

ehakehak-codeestoniaopendataphpspatial-data

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/koren-software-ehak-locations/health.svg)

```
[![Health](https://phpackages.com/badges/koren-software-ehak-locations/health.svg)](https://phpackages.com/packages/koren-software-ehak-locations)
```

###  Alternatives

[eg-mohamed/referenceable

Advanced Laravel package for generating customizable model reference numbers with flexible formats, sequential numbering, and comprehensive configuration options

796.7k](/packages/eg-mohamed-referenceable)[opilo/farsi

Farsi Tools for Dates and Numbers and Strings (with Laravel Validation Support)

333.2k1](/packages/opilo-farsi)[mervick/aaencoder

Encode/decode any JavaScript program to/from Japanese style emoticons

421.6k](/packages/mervick-aaencoder)

PHPackages © 2026

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