承接 marshmallow/address-prefiller 相关项目开发

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

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

marshmallow/address-prefiller

Composer 安装命令:

composer require marshmallow/address-prefiller

包简介

This package will get the full address information based on the zipcode and house number. Currently online dutch addresses are supported.

README 文档

README

alt text

Laravel Address Prefiller

Latest Version on Packagist Tests Total Downloads Issues License

This package prefills address fields based on a provided zipcode and house number. It currently only supports Dutch addresses. You can use it in your custom applications, or use the ready-made field with Laravel Nova.

The address data is retrieved from the official open API provided by the Dutch government (PDOK Locatieserver), which should contain the latest information.

Installation

Install the package via Composer:

composer require marshmallow/address-prefiller

The service provider (Marshmallow\Zipcode\FieldServiceProvider) is auto-discovered by Laravel, so there is nothing else to register.

Usage in Nova

A custom Laravel Nova field is available which you can use. It works very similarly to the Laravel Place field. The difference is that this field does not talk to Algolia, but to the official open API provided by the Dutch government, which should contain the latest information.

use Marshmallow\Zipcode\Nova\Zipcode;

public function fields(Request $request)
{
    return [
        ID::make()->sortable(),
        $this->addressFields(),
    ];
}

protected function addressFields()
{
    return $this->merge([
        Zipcode::make(__('Zipcode prefiller'), __('Zipcode'), __('Housenumber'))
            /**
             * Let the package know which columns are connected to
             * the fields. The default values are commented after each
             * function call. If your column names match these defaults,
             * you don't need to call all these functions.
             */
            ->zipcode('zipcode')         // default: zipcode
            ->housenumber('housenumber') // default: housenumber
            ->street('street')           // default: street
            ->city('city')               // default: city
            ->province('province')       // default: province
            ->country('country')         // default: country
            ->latitude('latitude')       // default: latitude
            ->longitude('longitude'),    // default: longitude

        /**
         * The fields below will all be prefilled with the collected
         * data if we find a match on the submitted zipcode and house number.
         */
        Hidden::make(__('Zipcode'), 'zipcode')->hideFromIndex(),
        Hidden::make(__('Housenumber'), 'address_2')->hideFromIndex(),
        Text::make(__('Street'), 'address_1')->hideFromIndex(),
        Text::make(__('City'), 'city')->hideFromIndex(),
        Text::make(__('Province'), 'province')->hideFromIndex(),
        Country::make(__('Country'), 'country')->hideFromIndex(),
        Text::make(__('Latitude'), 'latitude')->hideFromIndex(),
        Text::make(__('Longitude'), 'longitude')->hideFromIndex(),
    ]);
}

The field exposes a fluent setter for each address attribute so you can map it to the column names used in your resource: zipcode(), housenumber(), street(), city(), province(), country(), latitude() and longitude().

Usage manually

We have provided an example of how you can use this functionality in your own application. We've currently only used this in the Nova setting, so if you're missing anything, please let us know!

use Marshmallow\Zipcode\Facades\Zipcode;

return Zipcode::get(
    $request->zipcode,
    $request->housenumber
);

You can map the returned address fields to your own keys by chaining the setter methods before calling get():

use Marshmallow\Zipcode\Facades\Zipcode;

return Zipcode::street('address_1')
    ->city('city')
    ->province('province')
    ->country('country')
    ->latitude('latitude')
    ->longitude('longitude')
    ->get($request->zipcode, $request->housenumber);

Testing

composer test

Security Vulnerabilities

If you discover any security related issues, please email stef@marshmallow.dev instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see the License File for more information.

marshmallow/address-prefiller 适用场景与选型建议

marshmallow/address-prefiller 是一款 基于 Vue 开发的 Composer 扩展包,目前已累计 6.62k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 09 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 marshmallow/address-prefiller 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 6.62k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 26
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: Vue

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-09-03