atepam/laravel-alphavantage-client
Laravel的AlphaVantage客户端
0.1.5
2024-07-19 14:12 UTC
Requires
- php: ^8.1
- illuminate/console: ^11.16.0
- illuminate/support: ^11.16
Requires (Dev)
- laravel/pint: ^1.16
- mockery/mockery: ^1.6
- orchestra/testbench: ^9.2
- pestphp/pest: ^2.34
- phpstan/phpstan: ^1.11
README
安装
composer require atepam/laravel-alphavantage-client
配置
php artisan vendor:publish --provider="Atepam\AlphavantageClient\Providers\LatestPriceClientProvider" --tag="config"
服务
最新价格
https://www.alphavantage.co/documentation/#latestprice
用法
通过外观
$data = AVLatestPrice::getLatestPrice('IBM');
或者通过DI容器
<?php namespace App; use Atepam\AlphavantageClient\Services\LatestPrice; class ThisIsTheClass { public function __construct( public readonly LatestPrice $avLatestPrice, ) { // } public function getLatestPrice(string $symbol): array { return $this->avLatestPrice->getLatestPrice($symbol); } }
或者实例化
use Atepam\AlphavantageClient\Services\LatestPrice; $client = app(LatestPrice::class); $data = $client->getLatestPrice('IBM');