Download the PHP package ihangan/laravel-moldova-cuatm without Composer
On this page you can find all versions of the php package ihangan/laravel-moldova-cuatm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ihangan/laravel-moldova-cuatm
More information about ihangan/laravel-moldova-cuatm
Files in ihangan/laravel-moldova-cuatm
Package laravel-moldova-cuatm
Short Description Moldova's CUATM administrative-territorial divisions (raioane, cities, towns and villages) as Eloquent models with multilingual names and coordinates.
License MIT
Homepage https://github.com/ihangan/laravel-moldova-cuatm
Informations about the package laravel-moldova-cuatm
Moldova CUATM for Laravel
Every administrative-territorial unit of the Republic of Moldova, as an Eloquent model you can query straight away. The data comes from CUATM, the official classifier maintained by the National Bureau of Statistics, so the codes and the hierarchy match what government systems use.
You get the 32 raioane, the municipalities, the sectors of Chișinău, every town and all ~1,600 villages, plus Gagauzia and the Stînga Nistrului units. Each one carries its official CUATM code, a parent link, names in Romanian, Russian and Ukrainian, and WGS84 coordinates.
I built this for a rental classifieds site that needed a real location tree (region → city → sector → village) instead of a free-text address field, and pulled it out into a package because the dataset is useful on its own.
Requirements
- PHP 8.3 or higher
- Laravel 12 or 13
Installation
Publish and run the migration, then load the data:
cuatm:import is idempotent, so you can run it again whenever a new CUATM
edition ships without ending up with duplicates.
Usage
The model is Ihangan\MoldovaCuatm\Models\Location. It behaves like any other
Eloquent model.
Names
Names are translatable (backed by spatie/laravel-translatable). Romanian is always present; Russian and Ukrainian exist for most localities; English is filled in for the larger cities.
Set a fallback once (for example in a service provider) so a missing locale returns Romanian instead of an empty string:
Hierarchy
The tree is a self-referencing parent_id.
Coordinates
Facade
A small facade wraps the common lookups when you would rather not write the queries by hand:
Cascading location picker
roots() and childrenOf() are all you need to build a "pick a region, then a
locality below it" selector. The hierarchy isn't a fixed depth (a raion goes
straight to its villages, while Chișinău goes municipality → sector → town →
village), so the picker keeps offering another dropdown while the chosen unit
still has children.
The selected location is the last entry in $path. Outside Livewire the same two
calls drive any UI: render Cuatm::roots() first, then Cuatm::childrenOf($id)
each time a level is chosen.
Configuration
Publish the config file if you need to change the table name, the connection or the locales:
The table is named cuatm_locations rather than locations so it does not
clash with one your application may already have.
Data and updates
The dataset lives in database/data/cuatm.json and ships with the package.
- Codes, hierarchy and Romanian names come from CUATM (Clasificatorul unităților administrativ-teritoriale ale Republicii Moldova), published by the National Bureau of Statistics.
- Russian and Ukrainian names are Wikidata exonyms.
- Coordinates are from public geodata.
CUATM changes rarely. When the Bureau publishes a new edition, replace the JSON
file and run php artisan cuatm:import again.
Testing
Changelog
See releases.
Contributing
See CONTRIBUTING.md.
Security
Found a security issue? Email [email protected] instead of using the issue tracker. See SECURITY.md.
Credits
- Igor Hangan
- The administrative data comes from the CUATM classifier published by the National Bureau of Statistics of Moldova, with Russian and Ukrainian names from Wikidata.
License
The MIT License. See LICENSE.md.
The administrative data is public information from the National Bureau of Statistics of Moldova; Wikidata content is CC0.
All versions of laravel-moldova-cuatm with dependencies
illuminate/console Version ^12.0 || ^13.0
illuminate/contracts Version ^12.0 || ^13.0
illuminate/database Version ^12.0 || ^13.0
illuminate/support Version ^12.0 || ^13.0
spatie/laravel-package-tools Version ^1.92
spatie/laravel-translatable Version ^6.11