indeximstudio/laravel-countries_new
Composer 安装命令:
composer require indeximstudio/laravel-countries_new
包简介
A list of all countries, optimized for Laravel 9
README 文档
README
Very short description
Laravel-Countries, is a package that contains everything you need to start a new project and have all countries, information and translations on hand. And all this optimized for Laravel 8.
The package provides all data directly to your database, allowing you to link to any other table in your database, in a simple and usual way.
Geology and topology maps
Amongst many other information you'll be able to plot country maps:
Available Languages?
| Language |
|---|
| English |
| Portuguese |
| Spanish |
| Italian |
Requirements
-
PHP >= ^7.3 | ^8.0
-
laravel/framework >= ^8.12
-
dimsav/laravel-translatable >= ^11.8
Installation
You can install the package via composer:
composer require lwwcas/laravel-countries composer dump-autoload
- Put this line into database\seeds\DatabaseSeeder.php in run function
$this->call(\Lwwcas\LaravelCountries\Database\Seeders\LcDatabaseSeeder::class);
- Run migrations
php artisan migrate
- Run seeds or only the LcDatabaseSeeder class
php artisan db:seed
Usage
You can access all the information in the database with a simple query
use Lwwcas\LaravelCountries\Models\Country; Country::whereIso('BR')->first(); Country::whereIsoAlpha3('BRA')->first(); Country::whereSlug('brasil')->first();
How to integrate into my project?
In your table you can simply add the foreign key.
Only this will allow you to make a relationship with the country table
$table->integer('lc_country_id')->unsigned();
Being optional, but strongly recommended, you should use the Foreign Key Constraints that Laravel provides.
$table->foreign('lc_country_id')->references('id')->on('lc_countries');
Example of implementation in the users table
To make a relationship with the regions table
$table->tinyInteger('lc_region_id')->unsigned(); $table->foreign('lc_region_id')->references('id')->on('lc_regions');
Take a good look at the Model and see the package makes it easy
Example data
{
"id": 30,
"lc_region_id": 2,
"uuid": "343d2082-f6fb-42e6-ac7a-f78dad39de31",
"slug": "brazil",
"name": "Brazil",
"official_name": "Federative Republic of Brazil",
"iso_alpha_2": "BR",
"iso_alpha_3": "BRA",
"iso_numeric": 76,
"geoname_id": "3469034",
"international_phone": "55",
"languages": "[pt]",
"tld": "[.br]",
"wmo": "BZ",
"emoji": {
"img": "🇧🇷",
"uCode": "U+1F1E7 U+1F1F7"
},
"color_hex": [
"#008000",
"#ffff00"
],
"color_rgb": [
"0,128,0",
"255,255,0"
],
"coordinates": {
"latitude": {
"classic": "10 00 S",
"desc": "-10.81045150756836"
},
"longitude": {
"classic": "55 00 W",
"desc": "-52.97311782836914"
}
},
"coordinates_limit": {
"latitude": {
"max": "5.266667",
"min": "-33.733333"
},
"longitude": {
"max": "-28.85",
"min": "-73.75"
}
},
"visible": true,
"translations": [
{
"id": 30,
"lc_country_id": 30,
"name": "Brazil",
"slug": "brazil",
"locale": "en"
}
]
}
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email lwwcas@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
indeximstudio/laravel-countries_new 适用场景与选型建议
indeximstudio/laravel-countries_new 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 30 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 09 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「countries」 「Laravel-Countries」 「lwwcas」 「lucas duarte」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 indeximstudio/laravel-countries_new 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 indeximstudio/laravel-countries_new 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 indeximstudio/laravel-countries_new 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
List of all countries with names and ISO 3166-1 codes in all languages and data formats for Laravel
Laravel 5.2 package that provides basic geographical data like Countries, Regions and Cities.
Used to add country, state, city selectors to any laravel view. Provides all cities and states for 251 countries
Laravel Countries , Countries States Cities DB Migration & Seeder
Countries database for laravel
A package to delivery a wide seed array of Countries & their respective cities.
统计信息
- 总下载量: 30
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-09-30


