everapi / currencyapi-php

currencyapi.com API 的 PHP 封装器

v1.0.0 2022-05-06 09:56 UTC

This package is auto-updated.

Last update: 2024-09-27 16:31:11 UTC


README

currencyapi-php - PHP 货币转换器

Latest Version on Packagist Total Downloads

此包是 currencyapi.com 的 PHP 封装器,旨在使您在项目中使用 API 尽可能简单。

安装

您可以通过 composer 安装此包

composer require everapi/currencyapi-php

用法

使用您的 API 密钥(在 currencyapi.com 免费获取)初始化 API

$currencyApi = new \CurrencyApi\CurrencyApi\CurrencyApiClient('YOUR-API-KEY');

之后,您可以使用如下方式使用 API 的端点

echo $currencyApi->latest([
    'base_currency' => 'EUR',
    'currencies' => 'USD',
]);

免费账户可访问的端点

  • 状态
  • 货币
  • 最新
  • 历史

这些高级端点目前需要付费订阅

  • 转换
  • 范围

有关端点、参数和响应数据结构的更多信息,请参阅 文档

许可协议

MIT 许可协议 (MIT)。有关更多信息,请参阅 许可文件