承接 faicchia/laravel-nationalize 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

faicchia/laravel-nationalize

最新稳定版本:1.0.0

Composer 安装命令:

composer require faicchia/laravel-nationalize

包简介

A service wrapper around nationalize.io

README 文档

README

Packagist Tests Style License

A service wrapper around nationalize.io

Installation

composer require faicchia/laravel-nationalize

The package will automatically register itself.

Configuration

If you wish to edit the package configuration, you can run the following command to publish it into your config/ folder:

php artisan vendor:publish --provider="Faicchia\Nationalize\NationalizeServiceProvider"

Environment

If you purchased an API Key, add the following line to your .env file

NATIONALIZE_API_KEY=...

Usage

Single name

$response = Nationalize::name('Michael')->get()

print $response->status // 200 - HTTP response code

print $response->limit // 1000 - The amount of names available in the current time window

print $response->remaining // 728 - The number of names left in the current time window

print $response->reset // 15281 - Seconds remaining until a new time window opens

print $response->error // null - Error string

print $response->result->name // Michael

print $response->result->countries 
//  [
//    "US" => 0.08986482266532715,
//    "AU" => 0.05976757527083082,
//    "NZ" => 0.04666974820852911
//  ]

Multiple names

$response = Nationalize::name(['Michael', 'Kevin'])->get()
// or
$response = Nationalize::names(['Michael', 'Kevin'])->get()

foreach ($response->result as $prediction) {
    print $prediction->name
    print $prediction->countries 
}

Error

// e.g. Invalid API Key
$response = Nationalize::name('Michael')->get()

print $response->status // 401 
print $response->error // "Invalid API key"

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-07-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固