marshmallow/dataset-google-geotargets
Composer 安装命令:
composer require marshmallow/dataset-google-geotargets
包简介
Import all GeoTargets from Google into your Laravel project.
README 文档
README
Laravel Google Geo Targets
Import all GeoTargets from Google into your Laravel project.
This dataset contains all the geo locations from Google. We update the source when Google publishes a new one and you can reseed your data. By default only the Netherlands is imported, but you can change this in the config if you want to.
Installation
Install the package via Composer:
composer require marshmallow/dataset-google-geotargets
The service provider is registered automatically through Laravel package discovery.
Publish and run the migrations
Before you run the migration, publish the migrations first:
php artisan vendor:publish --provider="Marshmallow\Datasets\GoogleGeoTargets\ServiceProvider" --tag="migrations"
Run the migrations to create the database schema:
php artisan migrate
Publish the config
Publish the config so you are able to choose which countries will be seeded to the table and which data types will be seeded. By default this is set to the Netherlands and all data types. If the defaults work for you, you don't need to publish the config.
php artisan vendor:publish --provider="Marshmallow\Datasets\GoogleGeoTargets\ServiceProvider"
Configuration
The published config/google-geotargets.php file exposes the following options:
| Key | Default | Description |
|---|---|---|
countries |
['NL'] |
Alpha-2 country codes you wish to sync. An empty array seeds all countries. |
types |
All GoogleGeoTarget type constants |
The geo target types you wish to sync. |
The available type constants live on Marshmallow\Datasets\GoogleGeoTargets\Models\GoogleGeoTarget, for example GoogleGeoTarget::CITY, GoogleGeoTarget::PROVINCE, GoogleGeoTarget::COUNTRY, GoogleGeoTarget::AIRPORT and more.
Seed the tables
You need to seed two tables: the country table and the Google Geo Target table.
# Seed the country table. php artisan db:seed --class="Marshmallow\Datasets\Country\Seeders\CountrySeeder" # Seed the Google Geo Target table. php artisan db:seed --class="Marshmallow\Datasets\GoogleGeoTargets\Seeds\GoogleGeoTargetsSeeder"
Usage
Each GoogleGeoTarget is related to its type, its parent, and its child cities:
use Marshmallow\Datasets\Country\Models\Country; use Marshmallow\Datasets\GoogleGeoTargets\Models\GoogleGeoTarget; $country = Country::alpha2('NL'); $country->provinces->first()->cities->first()->name; // Resolve the type of a geo target. $target = GoogleGeoTarget::first(); $target->type->name;
Security Vulnerabilities
Please report security vulnerabilities by email to stef@marshmallow.dev rather than via the public issue tracker.
Credits
License
The MIT License (MIT). Please see the License File for more information.
marshmallow/dataset-google-geotargets 适用场景与选型建议
marshmallow/dataset-google-geotargets 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.34k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 07 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「marshmallow」 「GeoTargets」 「Geo Targets」 「Googel Geo Targets」 「Google GeoTargets」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 marshmallow/dataset-google-geotargets 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 marshmallow/dataset-google-geotargets 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 marshmallow/dataset-google-geotargets 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This packages provides you with the ability to easily connect your Laravel application to ZohoDesk.
Generate slugs when saving Eloquent models
Show geo marker on a mapbox map
Show geo shape on a mapbox map with drawing capabilities
A Laravel Nova help field.
Connect your Kiyoh to your Laravel application
统计信息
- 总下载量: 3.34k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2020-07-23