elephpant/quotation

Quotation 是一种简单的方法,可以提取货币情况,转换为 CURRENCY REAL (BRL),无论是当天的货币情况还是以前的周期,以及定义的间隔。包含大量的硬币,以获取您的 REAL (BRL) 状态。

dev-master 2020-06-16 01:45 UTC

This package is auto-updated.

Last update: 2024-09-16 11:16:17 UTC


README

Maintainer Source Code PHP from Packagist Latest Version Software License Build Quality Score Total Downloads

Quotation 是一种简单的方法,可以提取货币情况,转换为 CURRENCY REAL (BRL),无论是当天的货币情况还是以前的周期,以及定义的间隔。包含大量的硬币,以获取您的 REAL (BRL) 状态。

Quotation é uma forma simples de extrair a situação da moeda, seja no dia corrente ou em períodos anteriores, bem como em intervalos definidos. Contém uma vasta coleção de moedas para poder obter o seu status e converter para o REAL (BRL).

注意:此组件消耗了 AwesomeAPI 的货币报价 API (https://awesomeapi.com.br)

注意:此组件消耗了 AwesomeAPI 的货币报价 API (https://awesomeapi.com.br)

亮点

  • 极其简单
  • 支持多种货币
  • 灵活
  • Composer ready and PSR-2 compliant (准备就绪并符合 PSR-2)

货币 (moedas)

  • USD-BRL (商业美元)
  • USDT-BRL (旅游美元)
  • CAD-BRL (加拿大元)
  • AUD-BRL (澳大利亚元)
  • EUR-BRL (欧元)
  • GBP-BRL (英镑)
  • ARS-BRL (阿根廷比索)
  • JPY-BRL (日元)
  • CHF-BRL (瑞士法郎)
  • CNY-BRL (人民币)
  • YLS-BRL (以色列新谢克尔)
  • BTC-BRL (比特币)
  • LTC-BRL (莱特币)
  • ETH-BRL (以太坊)
  • XRP-BRL (瑞波币)

安装

Quotation 通过 Composer 提供

"elephpant/quotation": "*"

或者运行

composer require elephpant/quotation

文档

有关如何使用的详细信息,请参阅组件目录中的示例文件夹。其中包含每个类的使用示例。它的工作方式如下

有关如何使用的详细信息,请参阅组件目录中的示例文件夹。其中包含每个类的使用示例。它的工作方式如下

每个货币都有一个特定的类。

<?php
require __DIR__ . "/vendor/autoload.php";

use \ElePHPant\Quotation\Currencies\USDollar;
use \ElePHPant\Quotation\Currencies\Euro;
use \ElePHPant\Quotation\Currencies\Bitcoin;
use \ElePHPant\Quotation\Currencies\PoundSterling;
use \ElePHPant\Quotation\Currencies\Litecoin;
use \ElePHPant\Quotation\Currencies\JapaneseYene;


$dollar = new USDollar(); 
$dollar = new Euro(); 
$bitcoin = new Bitcoin();
$poundSterling = new PoundSterling();
$litecoin = new Litecoin();
$yene = new JapaneseYene();

//(For others classes, check the folder Currencies)

响应格式

<?php
require __DIR__ . "/vendor/autoload.php";

use \ElePHPant\Quotation\Currencies\USDollar;
use \ElePHPant\Quotation\Quotation;

// Each Class have a Param for format response in your Constructor Method.
// You can change the format Response (JSON or XML) 


$dollar = new USDollar(Quotation::RESPONSE_JSON); //Default 
$dollar = new USDollar(Quotation::RESPONSE_XML); //Bring the Response in XML format, but not structured

方法

<?php
require __DIR__ . "/vendor/autoload.php";

use \ElePHPant\Quotation\Currencies\USDollar;

$dollar = new USDollar();

//Bring the current status of currency with your variations in value and Percentual
$dollar->today(); 

//Bring the status of Currency in one interval
$dollar->interval(new \DateTime("2020-01-05"), new \DateTime("2020-03-05"));

//Return all status of currency in the last DAYS informed in the param
$dollar->period(4);

##常量

<?php
require __DIR__ . "/vendor/autoload.php";

use \ElePHPant\Quotation\Quotation;

//RESPONSE FORMATS

Quotation::RESPONSE_JSON;
Quotation::RESPONSE_XML;

//CURRENCIES
Quotation::CURRENCY_DOLAR;
Quotation::CURRENCY_DOLAR_TOURISM;
Quotation::CURRENCY_EURO;
Quotation::CURRENCY_CANADIAN_DOLAR;
Quotation::CURRENCY_AUSTRALIAN_DOLAR;
Quotation::CURRENCY_STERLING;
Quotation::CURRENCY_AUSTRALIAN_DOLAR;
Quotation::CURRENCY_ARGENTINIAN_PESO;
Quotation::CURRENCY_YEN_JAPAN;
Quotation::CURRENCY_SWISS_FRANC;
Quotation::CURRENCY_AUSTRALIAN_DOLAR;
Quotation::CURRENCY_CHINESE_YUAN;
Quotation::CURRENCY_ISRAELI_SHEKEL;
Quotation::CURRENCY_BITCOIN;
Quotation::CURRENCY_ETHEREUM;
Quotation::CURRENCY_LITECOIN;
Quotation::CURRENCY_RIPPLE;

同时获取多种货币的状态

<?php
require __DIR__ . "/vendor/autoload.php";

use \ElePHPant\Quotation\Quotation;
use \ElePHPant\Quotation\Generic;

$currencies = [
    Quotation::CURRENCY_DOLAR,
    Quotation::CURRENCY_EURO,
    Quotation::CURRENCY_BITCOIN
];

$generic = (new Generic($currencies))->quote();

var_dump($generic);

响应键

  • bid (购买 || Compra)
  • ask (卖出 || Venda)
  • varBid (变化 || 变化值)
  • pctChange (百分比变化 || 变化百分比)
  • high (最高 || Alta da Moeda)
  • low (最低 || Baixa da Moeda)

感谢 APIAwesome 提供简单直观的 API 和文档

APIAwesome - 货币 API

贡献

有关详细信息,请参阅 CONTRIBUTING

支持

安全:如果您发现任何与安全相关的问题,请通过电子邮件 sergiodanilojr@hotmail.com 联系,而不是使用问题跟踪器。

如果您发现任何与安全相关的问题,请通过电子邮件 sergiodanilojr@hotmail.com 联系,而不是使用问题跟踪器。

谢谢

致谢

许可

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