kokspflanze / alpha-vantage-api
Alpha Vantage API client
Installs: 7 014
Dependents: 1
Suggesters: 0
Security: 0
Stars: 61
Watchers: 11
Forks: 25
Open Issues: 0
Requires
- php: ^7.3 || ^8.0
- guzzlehttp/guzzle: ^6.5 || ^7.2
Requires (Dev)
- phpunit/phpunit: ^8.5.8
- squizlabs/php_codesniffer: ^3.5
Suggests
- psr/container: If you want use factories for PSR-11 Containers
README
The PHP-Client is a lightweight wrapper for the Alpha Vantage.
Requirements:
- PHP 7.1+
- composer (https://getcomposer.org/download/)
- AlphaVantage Key, that you get @ AlphaVantage-Api-Key
Install
php composer.phar require kokspflanze/alpha-vantage-api
How to use it?
<?php // Option $option = new AlphaVantage\Options(); $option->setApiKey('YOUR_KEY'); // Client $client = new AlphaVantage\Client($option); var_dump($client->foreignExchange()->currencyExchangeRate('BTC', 'CNY'));
Factory for PSR-11 Container
You can also use it with containers, using the PSR-11 standard for easy integration in a project.
You need require the suggest psr/container
package:
php composer.phar require psr/container
Register the Alpha Vantage Factory:
return [ 'dependencies' => [ 'factories' => [ 'alphavantage' => \AlphaVantage\Factory\AlphaVantageFactory::class, ], ], ];
with the following configuration:
return [ 'alpha_vantage' => [ 'api_key' => 'APIKEY', ] ];