xnekv03/nameday-api 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

xnekv03/nameday-api

Composer 安装命令:

composer require xnekv03/nameday-api

包简介

Nameday API library for https://nameday.abalin.net

README 文档

README

Name day API library for nameday.abalin.net

This library makes it easy to send requests towards nameday.abalin.net API. API provides name days for various countries.

Installation

The recommended way to install package is through Composer.

# Install Composer
curl -sS https://getcomposer.org/installer | php

Next, run the Composer command to install the latest stable version of package:

composer require xnekv03/nameday-api

After installing, you need to require Composer's autoloader:

require 'vendor/autoload.php';

You can then later update package using composer:

composer update

List of supported countries

  • Country names
    • United States
    • Czech Republic
    • Slovakia
    • Poland
    • France
    • Hungary
    • Croatia
    • Sweden
    • Austria
    • Italy
    • Germany
    • Spain
  • Country codes
    • us
    • cz
    • sk
    • pl
    • fr
    • hu
    • hr
    • se
    • at
    • it
    • de
    • es

Usage

create an instance of the class
use Xnekv03\ApiNameday\ApiNamedayClass as Nameday;

$nameday = new Nameday();
$nameday = new Nameday('America/Vancouver'); # time zone specification, other then system default (see below)
Request name days for today / tomorrow / yesterday
echo $nameday->today(); # {"data":{"day":27,"month":8,"name_us":"Caesar, Cesar ... }}
echo $nameday->tomorrow(); # {"data":{"day":28,"month":8,"name_us":"Agustin, August, Augusta ... }}
echo $nameday->yesterday(); # {"data":{"day":26,"month":8,"name_us":"Percival, Percy ... }}
Request name days for specific date
echo $nameday->specificDay(int $day, int $month);
echo $nameday->specificDay(21,10); # {"data":{"day":21,"month":10,"name_us":"Celina, Celine, Nobel" ... }}
Request name day in country calendar

Will return all days which contains the name.

searchByName(string $name)

echo $nameday->searchByName('Jan'); # {"calendar":"cz","results":[{"day":24,"month":5,"name":"Jana"},{"day":24,"month":6,"name":"Jan"} ... }}

Specification of time zone

Time zone is set by local php.ini settings. Therefore $nameday->today() will return result according to that. If you need to specify different time zone you can do so by adding optional parameter $timeZone to the constructor. $timeZone must be PHP time zones string or integer offset to GMT.

$nameday = new Nameday('Pacific/Honolulu');
echo $nameday->today(); # will return today name days according to Pacific/Honolulu time zone
$nameday = new Nameday('+13:30');
echo $nameday->tomorrow(); # will return today name days according to given UTC offset

Certificate

Make sure you have proper certificates stored on your local machine as Name day API uses HTTPS only.

If you run into problems with server certificate try downloading the The Mozilla CA certificate store, save it on your system and configure php.ini

[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
curl.cainfo = "C:\...\cacert.pem"

统计信息

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

GitHub 信息

  • Stars: 16
  • Watchers: 3
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-08-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固