定制 ayoub-amzil/offline-globe 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ayoub-amzil/offline-globe

最新稳定版本:1.1.5

Composer 安装命令:

composer require ayoub-amzil/offline-globe

包简介

Offline country data for PHP. Over 200 countries, capitals, flags, languages, currencies. No internet needed.

README 文档

README

Offline country data for PHP Laravel framework. Over 200 countries, capitals, flags, languages, currencies. No internet needed. This packages uses the 7 model continent, and this is a Reference for all the countries included.

Installation

  cd my-laravel-project
  composer require ayoub-amzil/offline-globe

Usage/Examples

Import class

use offline\Globe; 

Create an instance

$globe = new Globe();

Functions available

Return an array type value of all countries available

$globe->Countries()

Return an array type value of African countries

$globe->African()

Return an array type value of Asian countries

$globe->Asian()

Return an array type value of Australian countries

$globe->Australia()

Return an array type value of European countries

$globe->Europe()

Return an array type value of North America countries

$globe->NorthAmerica()

Return an array type value of South America countries

$globe->SouthAmerica()

Return the country code of the given country. The function accept one argument of type string.

$globe->Code('Morocco') // MA (return type: string)

Return the capital of the given country. The function accept one argument of type string.

$globe->Capital('japan') // Tokyo (return type: string)

Return the Languages spoken in the given country. The function accept one argument of type string.

$globe->Language('jamaica') // ['english', 'jamaican_patois'] (return type: array)

Return the currency used in the given country. The function accept one or two arguments

// 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)

Return the flag of the given country. The function accept three arguments. Country, type of the flag, and a directory name where the flags are saved.

// 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">

Authors

@ayoub-amzil

License

MIT

Contributing

Contributions are always welcome!

Acknowledgements

统计信息

  • 总下载量: 55
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-12-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固