joel-depiltech/codeigniter-holidayapi

CodeIgniter第三方库,基于官方PHP库处理假日API

安装: 23

依赖: 0

建议者: 0

安全: 0

星标: 2

关注者: 2

分支: 0

开放问题: 0

类型:codeigniter-third-party

1.1.0 2017-12-22 14:16 UTC

This package is not auto-updated.

Last update: 2024-09-15 04:31:30 UTC


README

Latest Stable Version License

CodeIgniter 第三方库,基于 假日API,基于 官方PHP库

安装

注意,以下步骤假设您已正确安装Composer并在服务器上配置了CodeIgniter。

请使用 Composer 安装它,并将其作为第三方 包含在您的CodeIgniter应用程序中。

composer require joel-depiltech/codeigniter-holidayapi

  1. 确保您已在配置文件(application/config/config.php)中使用了Composer自动加载器
$config['composer_autoload'] = TRUE; // or a custom path as 'vendor/autoload.php'
  1. 使用Loader库包含此
$this->load->add_package_path(APPPATH . 'third_party/holidayapi');
  1. 使用Loader库包含此
$this->load->library('HolidayAPI');
  1. 在配置文件(config/holidayapi.php)中配置您的 API密钥
$config['holidayapi_test_api_key'] = '058f4506-caf0-4bdd-b52b-cbc98e20e02e';
$config['holidayapi_live_api_key'] = '*** Fill in your own Live API key ***';

使用方法

简单调用

默认情况下,获取美国的今年所有假日

<?php
$this->load->library('HolidayAPI');
$holidays = $this->holidayapi->holidays();
print_r($holidays);

完整调用

一个示例,用于使用特定API密钥获取从圣诞节到2018年末的法国所有即将到来的假日

<?php
$this->load->library('HolidayAPI', array('holidayapi_live_api_key' => '** An other API key **'));
$holidays = $this->holidayapi->holidays('FR', 2018, 12, 25, FALSE, TRUE);
print_r($holidays);