Skip to content

Commit 793eafd

Browse files
committed
fix phpdoc
1 parent cedbc2c commit 793eafd

File tree

2 files changed

+73
-29
lines changed

2 files changed

+73
-29
lines changed

README.md

Lines changed: 71 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,130 @@
1-
# Forex for Laravel
1+
# Laravel Forex
22

3-
[![Latest Version on Packagist](https://img.shields.io/packagist/v/elegantly/laravel-forex.svg?style=flat-square)](https://packagist.org/packages/elegantly/laravel-forex)
4-
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/elegantly/laravel-forex/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/ElegantEngineeringTech/laravel-forex/actions?query=workflow%3Arun-tests+branch%3Amain)
5-
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/elegantly/laravel-forex/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/ElegantEngineeringTech/laravel-forex/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
3+
[![Latest Version on Packagist](https://img.shields.io/packagist/v/elegantly/laravel-forex.svg?style=flat-square)](https://packagist.org/packages/elegantly/laravel-forex)
4+
[![Tests](https://img.shields.io/github/actions/workflow/status/elegantly/laravel-forex/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/ElegantEngineeringTech/laravel-forex/actions?query=workflow%3Arun-tests+branch%3Amain)
5+
[![Code Style](https://img.shields.io/github/actions/workflow/status/elegantly/laravel-forex/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/ElegantEngineeringTech/laravel-forex/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
66
[![Total Downloads](https://img.shields.io/packagist/dt/elegantly/laravel-forex.svg?style=flat-square)](https://packagist.org/packages/elegantly/laravel-forex)
77

8-
Easily retreive latest exchange rates value in your app.
8+
**Laravel Forex** is a simple and flexible package for retrieving the latest and historical foreign exchange rates in your Laravel application.
99

10-
By default, this package use the free endpoint provided by [exchangerate-api.com](https://www.exchangerate-api.com/) but you can use it with any forex provider.
10+
By default, it uses the free tier from [exchangerate-api.com](https://www.exchangerate-api.com/), but you can easily configure it to use any other Forex provider.
1111

12-
## Installation
12+
---
1313

14-
You can install the package via composer:
14+
## 🚀 Installation
15+
16+
Install via Composer:
1517

1618
```bash
1719
composer require elegantly/laravel-forex
1820
```
1921

20-
You can publish the config file with:
22+
Publish the configuration file:
2123

2224
```bash
23-
php artisan vendor:publish --tag="laravel-forex-config"
25+
php artisan vendor:publish --tag="forex-config"
2426
```
2527

26-
This is the contents of the published config file:
28+
---
2729

28-
```php
30+
## ⚙️ Configuration
31+
32+
Here’s the default configuration that will be published to `config/forex.php`:
2933

34+
```php
3035
use Elegantly\Forex\Integrations\ExchangeRateApiFree\ExchangeRateApiFreeConnector;
3136

3237
return [
3338

3439
'cache' => [
3540
'enabled' => true,
3641
'driver' => env('FOREX_CACHE_DRIVER', env('CACHE_DRIVER', 'file')),
37-
'expiry_seconds' => 86_400,
42+
'expiry_seconds' => 86_400, // 1 day
3843
],
3944

4045
'rate_limit' => [
4146
'enabled' => false,
4247
'driver' => env('FOREX_RATE_LIMIT_DRIVER', env('CACHE_DRIVER', 'file')),
43-
'every_seconds' => 3_600,
48+
'every_seconds' => 3_600, // 1 hour
4449
],
4550

4651
'client' => ExchangeRateApiFreeConnector::class,
4752

53+
'clients' => [
54+
'exchange-rate-api' => [
55+
'token' => env('EXCHANGE_RATE_API_TOKEN'),
56+
],
57+
],
58+
4859
];
4960
```
5061

51-
## Usage
62+
---
63+
64+
## 📦 Usage
65+
66+
### Get Latest Rates
5267

5368
```php
69+
use Elegantly\Forex\Facades\Forex;
70+
71+
$rates = Forex::latest('USD');
72+
73+
$usdToEur = $rates['EUR'];
74+
```
5475

55-
$rates = \Elegantly\Forex\Facades\Forex::get('USD');
76+
### Get Historical Rates
5677

57-
$USD_to_EUR_rate = $rates['EUR'];
78+
```php
79+
use Carbon\Carbon;
80+
use Elegantly\Forex\Facades\Forex;
81+
82+
$rates = Forex::rates(Carbon::create(2022, 4, 25), 'USD');
5883

84+
$usdToEur = $rates['EUR'];
5985
```
6086

61-
## Testing
87+
---
88+
89+
## ✅ Testing
90+
91+
Run the test suite with:
6292

6393
```bash
6494
composer test
6595
```
6696

67-
## Changelog
97+
---
98+
99+
## 📄 Changelog
100+
101+
See the [CHANGELOG](CHANGELOG.md) for details on recent updates.
68102

69-
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
103+
---
70104

71-
## Contributing
105+
## 🤝 Contributing
72106

73-
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
107+
Contributions are welcome! Please read the [CONTRIBUTING](CONTRIBUTING.md) guide for details.
74108

75-
## Security Vulnerabilities
109+
---
76110

77-
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
111+
## 🔐 Security
78112

79-
## Credits
113+
If you discover any security-related issues, please refer to our [security policy](../../security/policy).
114+
115+
---
116+
117+
## 🙏 Credits
80118

81119
- [Quentin Gabriele](https://github.com/QuentinGab)
82120
- [All Contributors](../../contributors)
83121

84-
## License
122+
---
123+
124+
## 📃 License
125+
126+
This package is open-source software licensed under the [MIT license](LICENSE.md).
127+
128+
---
85129

86-
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
130+
Let me know if you'd like this version saved in a `README.md` file or if you want badges for other integrations!

src/Facades/Forex.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
use Illuminate\Support\Facades\Facade;
88

99
/**
10-
* @method static array<string, int|float> latest()
11-
* @method static array<string, int|float> rates()
10+
* @method static array<string, int|float> latest(string $currency)
11+
* @method static array<string, int|float> rates(Carbon $date, string $currency)
1212
* @method static array<string, int|float> refreshLatest()
1313
* @method static array<string, int|float> queryLatest()
1414
* @method static array<string, int|float> refreshRates()

0 commit comments

Comments
 (0)