wisdom-diala/countrypkg-laravel 问题修复 & 功能扩展

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

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

wisdom-diala/countrypkg-laravel

Composer 安装命令:

composer require wisdom-diala/countrypkg-laravel

包简介

package to fetch all countries and states around the world and store in the database

README 文档

README

package to fetch all countries and states around the world and store in the database

IMPORTANCE OF THE PACKAGE

NO API CALLS: Over the years i have been working with many API's that will help in getting countries with their State/Province, Making an API calls to the endpoint everytime a user visits the site, most of the times slow down the site while getting response from the third party website where the API was hosted. This packages eliminates any API calls of any such, you now have all the countries in your local database by running a simple command.

FEATURES

Generate Countries: This package helps you to generate countries around the world and save it inside your existing or newly created database without hitting any API endpoint.

Generate States: This package helps you to generate states/Province around the world with country ID generated initially when the country table was created. You can also generate State/Province for a particular country by specifying the country name you want to generate for.

USAGE

Install Package

composer require wisdom-diala/countrypkg-laravel

Create database if you don't have any database yet.

Run migration

php artisan migrate

After running migration, it will create two tables countries and states table

Run this command on your terminal to generate countries

php artisan g:c

This command will generate all countries around the world with it's country code and short name and save it in the countries table it created earlier.

Run this command on your terminal to generate all states/province

php artisan g:s all

This command generate all states with it's country ID from the country table that was initially created.

To generate states/province for a particular country run this command

php artisan g:s Nigeria

This command will generate all states/province in Nigeria.

Publish asset files

php artisan vendor:publish --tag=country_flags 

This command will publish the country flags images inside public/wisdom_countrypkg/img/country_flags

Using it in your controller

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use WisdomDiala\Countrypkg\Models\Country;
use WisdomDiala\Countrypkg\Models\State;

class TestController extends Controller
{
    public function getAllCountries()
    {
    	$countries = Country::all();
    	return view('pages.countries', compact('countries'));
    }

    public function getAllStates()
    {
    	$states = State::all();
    	return view('pages.states', compact('states'));
    }
}

Note: Make sure you import the Country and State Model that was shipped with the package.

That's all, you now have states and countries records in your local database and can use it anytime you want.

Watch the video on how to use the package here: https://youtu.be/7i1epKxxbd8

Countries and states records pulled from this API https://www.universal-tutorial.com/

Note: After installation of the package, you don't need any internet connection to generate the countries and states again.

If you really find this useful please give us a star.

wisdom-diala/countrypkg-laravel 适用场景与选型建议

wisdom-diala/countrypkg-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6.98k 次下载、GitHub Stars 达 21, 最近一次更新时间为 2021 年 04 月 01 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 wisdom-diala/countrypkg-laravel 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-04-01