All Projects → 1Forge → Php Forex Quotes

1Forge / Php Forex Quotes

Licence: mit
PHP Library for fetching realtime forex quotes.

Projects that are alternatives of or similar to Php Forex Quotes

javascript-forex-quotes
JavaScript Library for fetching realtime forex quotes.
Stars: ✭ 38 (-37.7%)
Mutual labels:  quotes, currency, forex, currency-converter
python-forex-quotes
Library to fetch and parse realtime Forex quotes and convert currencies
Stars: ✭ 25 (-59.02%)
Mutual labels:  quotes, currency, forex, currency-converter
currency-api
Free Currency Exchange Rates API with 150+ Currencies & No Rate Limits
Stars: ✭ 507 (+731.15%)
Mutual labels:  currency, forex, currency-converter
historical-bank-ruby
A Ruby Bank that serves historical exchange rates
Stars: ✭ 14 (-77.05%)
Mutual labels:  currency, currency-converter
GoCurrency
Simple currency converter. Insert an amount, what currency to convert from and what currency to convert to.
Stars: ✭ 29 (-52.46%)
Mutual labels:  currency, currency-converter
php-currency-api
Standardized wrapper for popular currency rate APIs. Currently supports FixerIO, CurrencyLayer, Open Exchange Rates and Exchange Rates API.
Stars: ✭ 17 (-72.13%)
Mutual labels:  currency, currency-converter
Swap
💱 Currency exchange rates library
Stars: ✭ 1,195 (+1859.02%)
Mutual labels:  currency, currency-converter
react-local-currency
💵 💴Shows the price of your services in the customer's currency 💶 💷
Stars: ✭ 21 (-65.57%)
Mutual labels:  currency, currency-converter
currency-converter
💰 Easily convert between 32 currencies
Stars: ✭ 16 (-73.77%)
Mutual labels:  currency, currency-converter
Coinonline
A Cryptocurrency/Blockchain wallet app based on React Native
Stars: ✭ 59 (-3.28%)
Mutual labels:  currency, currency-converter
Money
PHP implementation of Fowler's Money pattern.
Stars: ✭ 3,868 (+6240.98%)
Mutual labels:  currency, currency-converter
Coinc
💰💱Alfred Workflow for currencies conversion
Stars: ✭ 38 (-37.7%)
Mutual labels:  currency, currency-converter
Laravel Swap
💵 Currency exchange rates for Laravel and Lumen
Stars: ✭ 296 (+385.25%)
Mutual labels:  currency, currency-converter
Forex Python
Foreign exchange rates, Bitcoin price index and currency conversion using ratesapi.io
Stars: ✭ 378 (+519.67%)
Mutual labels:  currency, currency-converter
salaryconverter
Equivalent salary converter using PPP
Stars: ✭ 42 (-31.15%)
Mutual labels:  currency, currency-converter
Money
A money and currency library for PHP
Stars: ✭ 855 (+1301.64%)
Mutual labels:  currency, currency-converter
Android Money
Simple money and currency converter library for android.
Stars: ✭ 66 (+8.2%)
Mutual labels:  currency, currency-converter
Dinero
📈 💰 A golang interface for the Open Exchange Rates API
Stars: ✭ 68 (+11.48%)
Mutual labels:  currency, forex
Laravel Money
Currency formatting and conversion package for Laravel
Stars: ✭ 261 (+327.87%)
Mutual labels:  currency, currency-converter
Gocurrency
Simple currency converter. Insert an amount, what currency to convert from and what currency to convert to.
Stars: ✭ 26 (-57.38%)
Mutual labels:  currency, currency-converter

php-forex-quotes

php-forex-quotes is a PHP Library for fetching realtime forex quotes. See the examples for REST and WebSocket implementation in the /examples folder.

1Forge Data

Table of Contents

Requirements

Installation

composer require oneforge/forexquotes

Or in your composer.json

"require": {
    "oneforge/forexquotes": "3.1.0"
},

Usage

Instantiate the client

<?php

use OneForge\ForexQuotes\ForexDataClient;

//You can get an API key for free at 1forge.com
$client = new ForexDataClient('YOUR_API_KEY');

Get the list of available symbols:

$client->getSymbols(); 

Get quotes for specified symbols:

$client->getQuotes([
    'AUDUSD',
    'GBPJPY'
]);

Convert from one currency to another:

$client->convert('USD', 'EUR', 100);

Check if the market is open:

if ($client->marketIsOpen())
{
    echo "Market is open";    
}

Check your usage / quota limit:

$client->quota();

Stream quote updates:

WebSocket quote streaming is only available on paid plans.

//Handle incoming price updates from the server
$client->onUpdate(function($symbol, $data)
{
    echo $symbol . ": " . $data["bid"] . " " .$data["ask"] . " " . $data["price"]."\n";
});

//Handle non-price update messages
$client->onMessage(function($message)
{
    echo $message;
});

//Connect to the server
$client->connect(function($client)
{
    //Subscribe to a single currency pair
    $client->subscribeTo('EURUSD');

    //Subscribe to an array of currency pairs
    $client->subscribeTo([
        'GBPJPY',
        'AUDCAD',
        'EURCHF'
    ]);

    //Subscribe to all currency pairs
    $client->subscribeToAll();

    //Unsubscribe from a single currency pair
    $client->unsubscribeFrom('EURUSD');

    //Unsubscribe from an array of currency pairs
    $client->unsubscribeFrom([
        'GBPJPY',
        'AUDCAD',
        'EURCHF'
    ]);

    //Unsubscribe from all currency pairs
    $client->unsubscribeFromAll();

});

Contributing

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 protected] if you have any questions or requests.

License and Terms

This library is provided without warranty under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].