laravel-alphavantage-client maintained by atepam
Description
AlphaVantage Client for Laravel
Author
Last update
2024/07/19 16:12
(dev-main)
License
Downloads
14
Alpha Vantage API Client for Laravel
Installation
composer require atepam/laravel-alphavantage-client
Configuration
php artisan vendor:publish --provider="Atepam\AlphavantageClient\Providers\LatestPriceClientProvider" --tag="config"
Services
Latest Price
https://www.alphavantage.co/documentation/#latestprice
Usage
Via facade
$data = AVLatestPrice::getLatestPrice('IBM');
Or via DI container
<?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);
}
}
Or instantiate
use Atepam\AlphavantageClient\Services\LatestPrice;
$client = app(LatestPrice::class);
$data = $client->getLatestPrice('IBM');