承接 mgamadeus/ddd-common-political 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mgamadeus/ddd-common-political

Composer 安装命令:

composer require mgamadeus/ddd-common-political

包简介

Countries, languages, locales, political regions, states, localities for mgamadeus/ddd

README 文档

README

Countries, languages, locales, political regions, states, and localities for the mgamadeus/ddd framework.

Installation

composer require mgamadeus/ddd-common-political

What it does

Reference data entities for political geography and localization:

  • Country — 236 countries with multilingual names, ISO codes, TLD, phone prefix, address formatting, political region mapping
  • PoliticalRegion — hierarchical regions (6 continents → 15 sub-regions) with UN M49 codes
  • State — administrative area level 1 with geocoding support
  • Locality — city/town with GeoPoint, placeId, proximity search
  • Language — 66 languages (ISO 639-1/3, text direction, script codes)
  • Locale — 312 language+country combinations with date/time formats
  • County / SubCounty — administrative levels 2 and 3 (value objects)

Configuration (seed data)

The module ships with comprehensive seed data in config/app/Common/Political/:

File Contents
Countries.php 236 countries with multilingual names (20+ translations each), ISO codes, political region mapping, address settings
Languages.php 66 languages across 5 tiers with multilingual names, script codes
Locales.php 312 locale entries with date/time format rules
PoliticalRegions.php 6 continents + 15 sub-regions with UN M49 codes

Overriding config

Place a file at the same path in your project's config/app/Common/Political/ to override. Project config is searched before module config.

For example, to add a custom country or change an existing entry, create config/app/Common/Political/Countries.php in your project with the full array — it replaces the module's version entirely.

Service registration

Add to your project's services.yaml:

# DDD Module: ddd-common-political
DDD\Domain\Common\Services\PoliticalEntities\:
    resource: '%kernel.project_dir%/vendor/mgamadeus/ddd-common-political/src/Domain/Common/Services/PoliticalEntities/*'
    public: true

DDD\Domain\Common\Services\Languages\:
    resource: '%kernel.project_dir%/vendor/mgamadeus/ddd-common-political/src/Domain/Common/Services/Languages/*'
    public: true

Importing seed data

The module provides services with importFromConfig() methods. Create admin endpoints in your app that call these services:

// Import political regions (must run first — countries reference them)
$politicalRegionsService = PoliticalRegion::getService();
$regions = $politicalRegionsService->importPoliticalRegionsFromConfig();

// Import countries (resolves political region slugs to IDs)
$countriesService = Country::getService();
$countries = $countriesService->importCountriesFromConfig($politicalRegionsService);

// Import languages
$languagesService = Language::getService();
$languages = $languagesService->importLanguagesFromConfig();

// Import locales (resolves languageId and countryId)
$localesService = Locale::getService();
$locales = $localesService->importLocalesFromConfig($languagesService, $countriesService);

Import order

  1. PoliticalRegions first (countries reference them)
  2. Countries second (locales reference them)
  3. Languages third (locales reference them)
  4. Locales last (references both countries and languages)

Geocoding (via Argus)

States and localities can be geocoded via the Argus API:

  • ArgusStatePOST:/common/geodata/geocodeState (1-month cache)
  • ArgusLocalityPOST:/common/geodata/geocodeCity (1-month cache)

These require ARGUS_API_ENDPOINT to be configured (see ddd-argus).

Overriding entities

Extend any entity in your project using the standard DDD override mechanism:

// App\Domain\Common\Entities\PoliticalEntities\Countries\Country
namespace App\Domain\Common\Entities\PoliticalEntities\Countries;

use DDD\Domain\Common\Entities\PoliticalEntities\Countries\Country as BaseCountry;

class Country extends BaseCountry
{
    public bool $requiresEnhancedVerification = false;
}

No services.yaml entry needed — the DDD\ → App\ fallback resolves it automatically.

mgamadeus/ddd-common-political 适用场景与选型建议

mgamadeus/ddd-common-political 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 153 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 14 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 mgamadeus/ddd-common-political 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 mgamadeus/ddd-common-political 我们能提供哪些服务?
定制开发 / 二次开发

基于 mgamadeus/ddd-common-political 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 153
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 46
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-14