ayoub-amzil / offline-globe
PHP 的离线国家数据。包含超过 200 个国家的首都、国旗、语言、货币。无需互联网。
1.1.5
2024-02-14 20:06 UTC
README
PHP Laravel 框架的离线国家数据。包含超过 200 个国家的首都、国旗、语言、货币。无需互联网。此包使用 7 个模型大陆,所有包含的国家列表的 参考。
安装
cd my-laravel-project
composer require ayoub-amzil/offline-globe
使用/示例
导入类
use offline\Globe;
创建实例
$globe = new Globe();
可用的函数
返回所有可用的国家数组类型值
$globe->Countries()
返回非洲国家数组类型值
$globe->African()
返回亚洲国家数组类型值
$globe->Asian()
返回澳大利亚国家数组类型值
$globe->Australia()
返回欧洲国家数组类型值
$globe->Europe()
返回北美国家数组类型值
$globe->NorthAmerica()
返回南美国家数组类型值
$globe->SouthAmerica()
返回给定国家的国家代码。函数接受一个字符串类型的参数。
$globe->Code('Morocco') // MA (return type: string)
返回给定国家的首都。函数接受一个字符串类型的参数。
$globe->Capital('japan') // Tokyo (return type: string)
返回给定国家使用的语言。函数接受一个字符串类型的参数。
$globe->Language('jamaica') // ['english', 'jamaican_patois'] (return type: array)
返回给定国家使用的货币。函数接受一个或两个参数
// It can take only the country (mandatory) $globe->Currency('Canada') // ['name' => 'Canadian Dollar', 'code' => 'CAD'] (return type: array) // Or the country plus one type of information // name (option) $globe->Currency('canada','name') // Canadian Dollar (return type: string) // code (option) $globe->Currency('canada','code') // CAD (return type: string)
返回给定国家的国旗。函数接受三个参数。国家、国旗类型以及保存国旗的目录名称。
// country (mandatory) return view('welcome', ['flag'=>$globe->flag('united states')] ); // (return type: string) // In your template <img src="{{$flag}}" alt="image">
// type (option) [default=svg] return view('welcome', ['flag'=>$globe->flag('united states','png')] ); // (return type: string) // In your template <img src="{{$flag}}" alt="image">
// directory name (option) [default=flags] // PS: if you want to change your directory name, you have to set the type before return view('welcome', ['flag'=>$globe->flag('united states','png','images')] ); // (return type: string) // In your template <img src="{{$flag}}" alt="image">
作者
许可证
贡献
贡献总是受欢迎的!