Skip to content

Commit 7639d64

Browse files
committed
Added license info and docs for how to access result
1 parent 05f893e commit 7639d64

1 file changed

Lines changed: 24 additions & 5 deletions

File tree

README.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,63 +31,82 @@ Here's how you can access the fixer.io's endpoints:
3131
### [Latest rates endpoint](https://fixer.io/documentation#latestrates)
3232

3333
```php
34-
$fixerio->latest(
34+
$latestRates = $fixerio->latest(
3535
[
3636
'base' => 'USD', // optional
3737
'symbols' => 'INR', // optional
3838
]
3939
);
40+
41+
// Display the INR rates
42+
echo $latestRates['rates']['INR'];
4043
```
4144

4245
### [Historical rates endpoint](https://fixer.io/documentation#historicalrates)
4346

4447
```php
45-
$fixerio->historical(
48+
$historicalRates = $fixerio->historical(
4649
[
4750
'date' => '2019-01-01',
4851
'base' => 'USD', // optional
4952
'symbols' => 'INR', //optional
5053
]
5154
);
55+
56+
// Display the INR rates
57+
echo $latestRates['rates']['INR'];
5258
```
5359

5460
### [Convert endpoint](https://fixer.io/documentation#convertcurrency)
5561

5662
```php
57-
$fixerio->convert(
63+
$convertedRates = $fixerio->convert(
5864
[
5965
'from' => 'USD',
6066
'to' => 'INR',
6167
'amount' => 50.75,
6268
'date' => '2019-01-01', //optional
6369
]
6470
);
71+
72+
// Display the converted amount
73+
echo $convertedRates['result'];
6574
```
6675

6776
### [Time-Series data endpoint](https://fixer.io/documentation#timeseries)
6877

6978
```php
70-
$fixerio->timeseries(
79+
$timeseriesData = $fixerio->timeseries(
7180
[
7281
'start_date' => '2019-01-01',
7382
'end_date' => '2019-01-05',
7483
'base' => 'USD', // optional
7584
'symbols' => 'INR', //optional
7685
]
7786
);
87+
88+
// Display the INR rate for 2019-01-02
89+
echo $timeseriesData['rates']['2019-01-02']['INR'];
7890
```
7991

8092
### [Fluctuation data endpoint](https://fixer.io/documentation#timeseries)
8193

8294
```php
83-
$fixerio->fluctuation(
95+
$fluctuationData = $fixerio->fluctuation(
8496
[
8597
'start_date' => '2019-01-01',
8698
'end_date' => '2019-01-05',
8799
'base' => 'USD', // optional
88100
'symbols' => 'INR', //optional
89101
]
90102
);
103+
104+
// Display the change/fluctuation amount of INR between the given date range
105+
echo $fluctuationData['rates']['INR']['change'];
91106
```
92107

93108
The response for all the above calls will be a JSON object. Please refer fixer.io's [documentation](https://fixer.io/documentation) for further details about various endpoints, request parameters and response objects.
109+
110+
## License
111+
112+
This package is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

0 commit comments

Comments
 (0)