The tutorial column ofLaravelbelow will introduce you to the extensions of Laravel World. I hope it will be helpful to everyone!
Laravel World - country and city data with its own database (supports Chinese)
Laravel World (https://github.com/nnjeim/world) is A package that provides a list of countries, states, cities, currencies and time zones. World integrates data with Eloquent models through the database and provides Facades, helpers, and API routes:
use Nnjeim\World\World; $action = World::countries(); /* { "success": true, "message": "countries", "data": [ { "id": 1, "name": "Afghanistan" }, { "id": 2, "name": "Åland Islands" }, ... ], } */
Here is another example in the readme, using a filter to get the country and the people within that country City:
// 获取国家和城市 $action = World::countries([ 'fields' => 'states,cities', 'filters' => [ 'iso2' => 'FR', ] ]); /* { "success": true, "message": "countries", "data": [ "id": 77, "name": "France", "states": [ { "id": 1271, "name": "Alo" }, { "id": 1272, "name": "Alsace" }, ], "cities": [ { "id": 25148, "name": "Abondance" }, { "id": 25149, "name": "Abrest" }, ... ] ], } */
This package also supports localization (see readme for supported locales), provides APIs for all data, and has helper functions such as formatting phone numbers, etc.
You can learn more about this package, get complete installation instructions, and view the source code on GitHub. (https://github.com/nnjeim/world)
This package has been submitted to our Laravel News Links section. Links is where the community can publish packages and tutorials around the Laravel ecosystem. Follow @LaravelLinks on Twitter
Original address: https://laravel-news.com/laravel-world
Translation address: https://learnku.com /laravel/t/62354
The above is the detailed content of Look! This Laravel World extension supports Chinese!. For more information, please follow other related articles on the PHP Chinese website!