定制 krunalvat/location-dropdowns 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

krunalvat/location-dropdowns

Composer 安装命令:

composer require krunalvat/location-dropdowns

包简介

A Laravel package for Country, State, and City location dropdowns.

README 文档

README

A beautiful, lightweight, and automated Laravel package to sync and manage global Countries, States, and Cities in your database.

Perfect for marketing teams, e-commerce checkouts, and SaaS platforms that need reliable location dropdowns with zero manual data entry!

Features ✨

  • Automated Sync: A powerful Artisan command that instantly downloads and updates thousands of locations from a reliable open-source community database.
  • Dynamic Country Flags: Automatically generates and attaches flagcdn URLs to your API responses, allowing you to display beautiful flags in your frontend UI without bloating your database!
  • Proxy Flag Images: Built-in proxy routes to serve flags directly from your own domain, perfectly hiding the external CDN from your frontend.
  • Fully Normalized Tables: Clean and highly-optimized database architecture (Countries -> States -> Cities).
  • API Ready: Comes with fast, built-in JSON API endpoints out-of-the-box.
  • Zero Configuration: The data source is securely obfuscated within the codebase, requiring no messy .env setups to get started.

Installation 🚀

You can install the package via composer:

composer require krunalvat/location-dropdowns

Getting Started

  1. Publish the Migrations & Config (Optional)
php artisan vendor:publish --tag="location-migrations"
php artisan vendor:publish --tag="location-config"
  1. Run the Migrations Create the necessary tables in your database:
php artisan migrate
  1. Sync the Data! Run the automated sync command to populate your database with the latest global location data:
php artisan locations:sync

Usage 💻

Once synced, your application will immediately have access to three new API routes:

  • GET /api/locations/countries (Returns all countries with dynamic flag URLs attached!)
  • GET /api/locations/states/{country_id}
  • GET /api/locations/cities/{state_id}

Example Frontend Response

{
  "id": 101,
  "name": "India",
  "iso2": "IN",
  "phonecode": "91",
  "flag_url": "http://yourdomain.com/api/locations/flags/in"
}

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固