Saudi National Address
This module provides a reusable administrative geography for Saudi Arabia, including regions, cities, and districts, with both Arabic and English translations. It offers dependent address fields that create a cascading selection experience for these locations and a central service to manage all address-related logic, including lookups and validation.
Saudi National Address provides an authoritative, reusable source of
Saudi Arabia's administrative geography — regions → cities →
districts — with full Arabic/English translations, ready-to-use dependent
address fields, and a single service that centralises all address logic.
Data is sourced from the
yasseralsamman/saudi-national-address
package and imported into three translatable taxonomy vocabularies
(sna_region, sna_city, sna_district) via a Drush
command or an admin UI.
Key features
- Bilingual taxonomy: ~13 regions, ~4,500 cities and thousands
of districts, with English (default) and Arabic translations. - Dependent address fields: attach standard entity reference
fields to any entity and get a cascading region → city → district experience:
choosing a region filters the city options, and choosing a city filters the district
options. A custom selection handler also rejects, on submit, any child that does not
belong to the selected parent. - AddressResolver service: the single source of address logic.
Resolve a full hierarchy from an 11-digit district ID, look up regions/cities/districts
by their National Address ID, navigate the hierarchy, run typeahead searches, work with
geo coordinates (nearest city/region, distance), and validate hierarchies. Returns typed,
language-aware value objects. You can also do Reverse Lookup from LatLng to SNA. - Idempotent importer: seed or refresh the data with
drush sna:import(or from Configuration » Regional » Saudi
National Address), using the Batch API so large datasets do not time out.
Requirements
- Drupal 10+
- PHP 8.1+
- The
yasseralsamman/saudi-national-addressComposer packagecomposer require yasseralsamman/saudi-national-address
For installation steps, the full AddressResolver API, and instructions on
wiring up dependent fields, see the README.md file of the module.