Looking to hire Laravel developers? Try LaraJobs

laravel-alphavantage-client maintained by atepam

Description
AlphaVantage Client for Laravel
Author
Last update
2024/07/19 16:12 (dev-main)
License
Links
Downloads
14

Comments
comments powered by Disqus

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');