westy92/holiday-event-api 问题修复 & 功能扩展

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

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

westy92/holiday-event-api

最新稳定版本:v1.0.1

Composer 安装命令:

composer require westy92/holiday-event-api

包简介

The Official Holiday and Event API for PHP

README 文档

README

Packagist Version Packagist PHP Version Build Status Code Coverage Type Coverage Funding Status

Industry-leading Holiday and Event API for PHP. Over 5,000 holidays and thousands of descriptions. Trusted by the World’s leading companies. Built by developers for developers since 2011.

Supported PHP Versions

The latest version of the the Holiday and Event API is compatible with all currently-supported PHP releases.

Authentication

Access to the Holiday and Event API requires an API Key. You can get for one for FREE here, no credit card required! Note that free plans are limited. To access more data and have more requests, a paid plan is required.

Installation

The recommended way to install the Holiday and Event API is through Composer.

composer require westy92/holiday-event-api

Example

try {
    // Get a FREE API key from https://apilayer.com/marketplace/checkiday-api#pricing
    $client = new Westy92\HolidayEventApi\Client('<your API key>');

    // Get Events for a given Date
    $events = $client->getEvents(
        // These parameters are the defaults but can be specified:
        // date: 'today',
        // timezone: 'America/Chicago',
        // adult: false,
    );

    $event = $events->events[0];
    echo "Today is {$event->name}! Find more information at: {$event->url}." . PHP_EOL;
    echo "Rate limit remaining: {$events->rateLimit?->remainingMonth}/{$events->rateLimit?->limitMonth} (month)." . PHP_EOL;

    // Get Event Information
    $eventInfo = $client->getEventInfo(
        id: $event->id,
        // These parameters can be specified to calculate the range of eventInfo->Event->Occurrences
        // start: 2020,
        // end: 2030,
    );

    $hashtags = implode(', ', $eventInfo->event->hashtags);
    echo "The Event's hashtags are {$hashtags}." . PHP_EOL;

    // Search for Events
    $query = "zucchini";
    $search = $client->search(
        query: $query,
        // These parameters are the defaults but can be specified:
        // adult: false,
    );

    $count = count($search->events);
    echo "Found {$count} events, including '{$search->events[0]->name}', that match the query '{$query}'." . PHP_EOL;
} catch (\Exception $e) {
    echo $e;
}

License

The Holiday and Event API is made available under the MIT License (MIT). Please see the License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-12-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固