Skip to content
This repository was archived by the owner on Oct 14, 2023. It is now read-only.

Commit fbfd3fb

Browse files
committed
Changed to be an integration of the currency library
1 parent 9fcb847 commit fbfd3fb

26 files changed

+208
-824
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Changelog
2+
3+
## 4.0.0 - 2021-05-15
4+
5+
- Namespace moved from `AmrShawky\Currency` to `AmrShawky\LaravelCurrency`
6+
- The package now is a Laravel integration for [Currency](https://github.com/amrshawky/currency) library

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ composer require amrshawky/laravel-currency
2020
To convert from one currency to another you may chain the methods:
2121

2222
```php
23-
use AmrShawky\Currency\Facade\Currency;
23+
use AmrShawky\LaravelCurrency\Facade\Currency;
2424

2525
Currency::convert()
2626
->from('USD')
@@ -32,7 +32,7 @@ This will return the converted amount or `null` on failure.
3232
The amount to be converted is default to `1`, you may specify the amount:
3333

3434
```php
35-
use AmrShawky\Currency\Facade\Currency;
35+
use AmrShawky\LaravelCurrency\Facade\Currency;
3636

3737
Currency::convert()
3838
->from('USD')
@@ -44,7 +44,7 @@ Currency::convert()
4444
- Convert currency using historical exchange rates `YYYY-MM-DD`:
4545

4646
```php
47-
use AmrShawky\Currency\Facade\Currency;
47+
use AmrShawky\LaravelCurrency\Facade\Currency;
4848

4949
Currency::convert()
5050
->from('USD')
@@ -56,7 +56,7 @@ Currency::convert()
5656
- Round the converted amount to decimal places:
5757

5858
```php
59-
use AmrShawky\Currency\Facade\Currency;
59+
use AmrShawky\LaravelCurrency\Facade\Currency;
6060

6161
Currency::convert()
6262
->from('USD')
@@ -68,7 +68,7 @@ Currency::convert()
6868
- You may also switch data source between forex `default`, bank view or crypto currencies:
6969

7070
```php
71-
use AmrShawky\Currency\Facade\Currency;
71+
use AmrShawky\LaravelCurrency\Facade\Currency;
7272

7373
Currency::convert()
7474
->from('BTC')
@@ -81,7 +81,7 @@ Currency::convert()
8181
To get latest rates you may chain the methods:
8282

8383
```php
84-
use AmrShawky\Currency\Facade\Currency;
84+
use AmrShawky\LaravelCurrency\Facade\Currency;
8585

8686
Currency::rates()
8787
->latest()
@@ -102,7 +102,7 @@ This will return an `array` of all available currencies or `null` on failure.
102102
- Just like currency conversion you may chain any of the available methods:
103103

104104
```php
105-
use AmrShawky\Currency\Facade\Currency;
105+
use AmrShawky\LaravelCurrency\Facade\Currency;
106106

107107
Currency::rates()
108108
->latest()
@@ -118,7 +118,7 @@ Currency::rates()
118118
Historical rates are available for most currencies all the way back to the year of 1999.
119119

120120
```php
121-
use AmrShawky\Currency\Facade\Currency;
121+
use AmrShawky\LaravelCurrency\Facade\Currency;
122122

123123
Currency::rates()
124124
->historical('2020-01-01') //`YYYY-MM-DD` Required date parameter to get the rates for
@@ -135,7 +135,7 @@ Currency::rates()
135135
```
136136
Same as latest rates you may chain any of the available methods:
137137
```php
138-
use AmrShawky\Currency\Facade\Currency;
138+
use AmrShawky\LaravelCurrency\Facade\Currency;
139139

140140
Currency::rates()
141141
->historical('2020-01-01')
@@ -151,7 +151,7 @@ Timeseries are for daily historical rates between two dates of your choice, with
151151
This will return an `array` or `null` on failure.
152152

153153
```php
154-
use AmrShawky\Currency\Facade\Currency;
154+
use AmrShawky\LaravelCurrency\Facade\Currency;
155155

156156
Currency::rates()
157157
->timeSeries('2021-05-01', '2021-05-02') //`YYYY-MM-DD` Required dates range parameters
@@ -179,7 +179,7 @@ Retrieve information about how currencies fluctuate on a day-to-day basis, with
179179
This will return an `array` or `null` on failure.
180180

181181
```php
182-
use AmrShawky\Currency\Facade\Currency;
182+
use AmrShawky\LaravelCurrency\Facade\Currency;
183183

184184
Currency::rates()
185185
->fluctuations('2021-03-29', '2021-04-15') //`YYYY-MM-DD` Required dates range parameters
@@ -208,7 +208,7 @@ The default behavior is to return `null` for errors that occur during the reques
208208
If you would like to throw an exception instead, you may use the `throw` method, The `throw` method returns the currency instance, allowing you to chain other methods:
209209

210210
```php
211-
use AmrShawky\Currency\Facade\Currency;
211+
use AmrShawky\LaravelCurrency\Facade\Currency;
212212

213213
Currency::convert()
214214
->from('USD')
@@ -221,7 +221,7 @@ Currency::convert()
221221
If you would like to perform some additional logic before the exception is thrown, you may pass a closure to the throw method:
222222

223223
```php
224-
use AmrShawky\Currency\Facade\Currency;
224+
use AmrShawky\LaravelCurrency\Facade\Currency;
225225

226226
Currency::convert()
227227
->from('USD')
@@ -237,7 +237,7 @@ Currency::convert()
237237
- You may use the `withoutVerifying` method to indicate that TLS certificates should not be verified when sending the request:
238238

239239
```php
240-
use AmrShawky\Currency\Facade\Currency;
240+
use AmrShawky\LaravelCurrency\Facade\Currency;
241241

242242
Currency::convert()
243243
->from('USD')
@@ -249,7 +249,7 @@ Currency::convert()
249249
- You may specify additional [Guzzle request options](https://docs.guzzlephp.org/en/stable/request-options.html "Guzzle request options") using the `withOptions` method. The `withOptions` method accepts an array of key / value pairs:
250250

251251
```php
252-
use AmrShawky\Currency\Facade\Currency;
252+
use AmrShawky\LaravelCurrency\Facade\Currency;
253253

254254
Currency::rates()
255255
->historical('2021-04-30')
@@ -262,7 +262,7 @@ Currency::rates()
262262

263263
- The `when` method will execute the given callback when the first argument given to the method evaluates to true:
264264
```php
265-
use AmrShawky\Currency\Facade\Currency;
265+
use AmrShawky\LaravelCurrency\Facade\Currency;
266266

267267
Currency::rates()
268268
->latest()
@@ -282,7 +282,7 @@ Currency::rates()
282282
Currency uses Laravel facades which makes it easy to [mock](https://laravel.com/docs/8.x/mocking#mocking-facades "Mocking Laravel Facades") so it's not actually executed during the test:
283283

284284
```php
285-
use AmrShawky\Currency\Facade\Currency;
285+
use AmrShawky\LaravelCurrency\Facade\Currency;
286286

287287
Currency::shouldReceive('convert')
288288
->once()

composer.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,29 @@
1919
"php": ">=7.2",
2020
"guzzlehttp/guzzle": ">=6.0",
2121
"ext-json": "*",
22-
"illuminate/support": ">=6.0"
22+
"illuminate/support": "^6.0|^7.0|^8.0",
23+
"amrshawky/currency": "^1.0"
2324
},
2425
"require-dev": {
2526
"phpunit/phpunit": ">=8.0"
2627
},
2728
"autoload": {
2829
"psr-4": {
29-
"AmrShawky\\Currency\\": "src"
30+
"AmrShawky\\LaravelCurrency\\": "src"
3031
}
3132
},
3233
"autoload-dev": {
3334
"psr-4": {
34-
"AmrShawky\\Currency\\Tests\\": "tests"
35+
"AmrShawky\\LaravelCurrency\\Tests\\": "tests"
3536
}
3637
},
3738
"extra": {
3839
"laravel": {
3940
"providers": [
40-
"AmrShawky\\Currency\\CurrencyServiceProvider"
41+
"AmrShawky\\LaravelCurrency\\CurrencyServiceProvider"
4142
],
4243
"aliases": {
43-
"Currency": "AmrShawky\\Currency\\Facade\\Currency"
44+
"Currency": "AmrShawky\\LaravelCurrency\\Facade\\Currency"
4445
}
4546
}
4647
},

0 commit comments

Comments
 (0)