centrex/laravel-open-exchange-rates
最新稳定版本:v1.2.0
Composer 安装命令:
composer require centrex/laravel-open-exchange-rates
包简介
This is my package laravel-open-exchange-rates
README 文档
README
This package provides a simple and convenient interface for working with the Open Exchange Rates service. Currently supports free endpoints.
Contents
Installation
You can install the package via composer:
composer require centrex/laravel-open-exchange-rates
You can publish the config file with:
php artisan vendor:publish --tag="laravel-open-exchange-rates-config"
This is the contents of the published config file:
return [ 'app_id' => 'your_own_appid', 'default_base_currency' => 'USD' ];
Usage
In config/loer.php
return [ 'app_id' => '*****************************', // your own api key 'default_base_currency' => 'USD' ];
In controller (or service) method:
use Centrex\LaravelOpenExchangeRates\Client; class SomeController extends Controller { private $client; public function __construct(Client $client) { $this->client = $client; } public function someAction() { $coefficient = $this->client->latest('USD,RUB,AWG'); $historical_coefficent $this->client->historical('2011-03-05', 'USD,RUB,AWG'); // e.t.c... // Change in base currencies (not allowed for free account) and requests for the coefficients of all currencies relative to. $coefficient = $this->client->currency('RUB')->latest(); } }
Testing
🧹 Keep a modern codebase with Pint:
composer lint
✅ Run refactors using Rector
composer refacto
⚗️ Run static analysis using PHPStan:
composer test:types
✅ Run unit tests using PEST
composer test:unit
🚀 Run the entire test suite:
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 2.22k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-03-14