Home> PHP Framework> Laravel> body text

Look! This Laravel World extension supports Chinese!

藏色散人
Release: 2021-11-08 15:48:44
forward
1608 people have browsed it

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" }, ... ], } */
Copy after login

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" }, ... ] ], } */
Copy after login

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!

Related labels:
source:learnku.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!