bkfdev/laravel-world
Composer 安装命令:
composer require bkfdev/laravel-world
包简介
:package_description
README 文档
README
The Laravel-World is a Laravel package which provides a list of the countries, states, cities, timezones, currencies and languages.
It can be consumed with the World Facade
Installation
Via Composer
composer require bkfdev/laravel-world
Publish
php artisan vendor:publish --force --provider="Bkfdev\World\LaravelWorldServiceProvider"
Setup Config
<?php return [ /* |-------------------------------------------------------------------------- | Allowed countries to be loaded | Leave it empty to load all countries |-------------------------------------------------------------------------- */ 'allowed_countries' => [], /* |-------------------------------------------------------------------------- | Disallowed countries to not be loaded | Leave it empty to allow all countries to be loaded |-------------------------------------------------------------------------- */ 'disallowed_countries' => [], /* |-------------------------------------------------------------------------- | Supported locales. |-------------------------------------------------------------------------- */ 'accepted_locales' => [ 'ar', 'en', /* 'bn', 'br', 'de', 'es', 'fr', 'ja', 'kr', 'nl', 'pl', 'pt', 'ro', 'ru', 'zh', */ ], /* |-------------------------------------------------------------------------- | Enabled modules. | The cities module depends on the states module. |-------------------------------------------------------------------------- */ 'modules' => [ 'states' => true, 'cities' => true, 'timezones' => true, 'currencies' => true, 'languages' => true, ], /* |-------------------------------------------------------------------------- | Migrations. |-------------------------------------------------------------------------- */ 'migrations' => [ 'countries' => [ 'table_name' => 'world_countries', 'optional_fields' => [ ...
Migrate
php artisan migrate
Run Command to import data
php artisan world:init
Or you may add some countries by running this command :
php artisan world:add us sa dz
Usage
It's just an eloquent so you may run whetever your want
use Bkfdev\World\World;
Get All countries :
$countries = World::Countries();
Get country by code iso2 or iso3 :
$country = World::getCountryByCode($code); return : [ "id" => 1 "iso2" => "DZ" "name" => "Algeria" "status" => 1 "phone_code" => "213" "iso3" => "DZA" "native" => "الجزائر" "region" => "Africa" "subregion" => "Northern Africa" "latitude" => "28.00000000" "longitude" => "3.00000000" "emoji" => "🇩🇿" "emojiU" => "U+1F1E9 U+1F1FF" ]
Get country by name :
$country = World::getCountryByName($name);
Get states of a give country by code :
$states = World::getStatesOfCountry($code);
Change log
Please see the changelog for more information on what has changed recently.
Testing
composer test
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email bkfdev@gmail.com instead of using the issue tracker.
Credits
License
MIT. Please see the license file for more information.
bkfdev/laravel-world 适用场景与选型建议
bkfdev/laravel-world 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 45 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 05 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「states」 「countries」 「world」 「currencies」 「cities」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 bkfdev/laravel-world 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bkfdev/laravel-world 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 bkfdev/laravel-world 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
List of all countries with names and ISO 3166-1 codes in all languages and data formats for Laravel
PHP extension with Brazilian states and formats for CPF, CNPJ and ZIP
Laravel 5.2 package that provides basic geographical data like Countries, Regions and Cities.
A simple PHP class for United States Postal Service (USPS) addresses
Convert and operate with FIPS codes for states, counties, etc.
PHP Countries and Currencies
统计信息
- 总下载量: 45
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-05-23