serendipity_hq/component-geo-builder 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

serendipity_hq/component-geo-builder

Composer 安装命令:

composer require serendipity_hq/component-geo-builder

包简介

Parses the exports of countries from Geonames and exports the data in machine readable formats.

关键字:

README 文档

README

Serendipity HQ Geo Builder

Parses the exports of countries from Geonames and exports the data in machine readable formats.
It downloads information of countries from [Geonames exports](https://www.geonames.org/export/zip/).
Ready to be integrated in Symfony apps.

Supports

Tested on

Current Status

Coverage Maintainability Rating Quality Gate Status Reliability Rating Security Rating Technical Debt Vulnerabilities

Phan PHPStan PSalm PHPUnit Composer PHP CS Fixer Rector

Features

  • Download the exports of countries
  • Build you custom lists of countries to use in your app

Do you like this library?
LEAVE A ★

or run
composer global require symfony/thanks && composer thanks
to say thank you to all libraries you use in your current project, this included!

Installation and Configuration

Install Component GeoBuilder via Composer

composer req serendipity_hq/component-geo-builder

This library follows the http://semver.org/ versioning conventions.

However, until the version 1, the minor release is treated like a major one.

So it is possible a break in the public API between minor versions (0.1 > 0.2 > 0.3).).

The component is anyway stable and can be used in production, also if it is not very flexible.

See the issues to know more about what we have in mind to implement.

Register the command in a Symfony application

Open the file config/services.yaml and add the class of the geobuilder command:

# config/services.yaml

services:
    ...
    SerendipityHQ\Component\GeoBuilder\Command\BuildCommand:
        $dumpDir: '%kernel.cache_dir%/geobuilder'

    # You also need to autowire the Guzzle CLient if you don't already have one
    GuzzleHttp\Client: ~
    ...

Building the list you need

To build the list you need, simply launch the command geobuilder:build appending the countries you want to build lists for:

$ bin/console geobuilder:build it de

By default the command uses the Hierarchy reader and will create a lot of json files in the kernel.cache_dir/geobuilder folder of your Symfony App.

You can read more about readers, saving folders and more reading the full documentation.

For the moment, let's continue putting GeoBuilder at work.

The next step is to create a form with the data we have just built.

Creating the form

To use the form types, you need to register them as services, so they can be properly initialized by Symfony.

To register them, open the file config/services.yaml and add the HierarchyJsonType:

# config/services.yaml

services:
    ...
    SerendipityHQ\Component\GeoBuilder\Reader\HierarchyJsonReader:
        $dataFolderPath: '%kernel.cache_dir%/geobuilder'
    SerendipityHQ\Component\GeoBuilder\Bridge\Symfony\Form\Type\HierarchyJsonType: ~

Then in your form you can add the HierarchyJsonType:

class UserZoneType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array<string,mixed>  $options
     * @suppress PhanUnusedPublicMethodParameter
     */
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder->add('geobuilder', HierarchyJsonType::class, ['country' => 'it']);
    }
}

About the countries.json file

This file will contain only the countries you built with the bin/console geobuilder:build command.

You can get a complete list of localized countries using the Countries::getNames() method of the symfony/intl component.

But the Symfony component will return all countries in the world, also if you didn't built them.

Do you like this library?
LEAVE A ★

or run
composer global require symfony/thanks && composer thanks
to say thank you to all libraries you use in your current project, this included!

serendipity_hq/component-geo-builder 适用场景与选型建议

serendipity_hq/component-geo-builder 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 272 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 01 月 29 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「geonames」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 serendipity_hq/component-geo-builder 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 272
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 13
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-01-29