|Last Updated|| ||Ratings|| ||Unique User Downloads|| ||Download Rankings|
|2018-05-23 (6 months ago) ||Not enough user ratings||Total: 56 ||All time: 9,336 This week: 392|
This package can get foreign exchange rates quotes for currencies.
It can send HTTP requests to the 1forge.com API to get the list of supported currency symbols.
The class can also get quotes for exchange of given currencies.
php-forex-quotes is a PHP Library for fetching realtime forex quotes. See the examples for REST and WebSocket implementation in the /examples folder.
Table of Contents
- PHP >= 5.6.4
- An API key which you can obtain for free at http://1forge.com/forex-data-api
composer require oneforge/forexquotes
Or in your composer.json
Instantiate the client
//You can get an API key for free at 1forge.com
$client = new ForexDataClient('YOUR_API_KEY');
Get the list of available symbols:
Get quotes for specified symbols:
Convert from one currency to another:
$client->convert('USD', 'EUR', 100);
Check if the market is open:
echo "Market is open";
Check your usage / quota limit:
Stream quote updates:
WebSocket quote streaming is only available on paid plans.
//Handle incoming price updates from the server
echo $symbol . ": " . $data["bid"] . " " .$data["ask"] . " " . $data["price"]."\n";
//Handle non-price update messages
//Connect to the server
//Subscribe to a single currency pair
//Subscribe to an array of currency pairs
//Subscribe to all currency pairs
//Unsubscribe from a single currency pair
//Unsubscribe from an array of currency pairs
//Unsubscribe from all currency pairs
Thank you for considering contributing! Any issues, bug fixes, suggestions, improvements or help in any other way is always appreciated. Please feel free to open an issue or create a pull request.
Support and Contact
Please contact me at email@example.com if you have any questions or requests.
License and Terms
This library is provided without warranty under the MIT license.
||Applications that use this package
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.