Skip to content

docs: list unirate_api in config/swap.php + provider tables - #99

Merged
alies-dev merged 1 commit into
florianv:masterfrom
rob-browncc:add-unirate-api
Jun 17, 2026
Merged

docs: list unirate_api in config/swap.php + provider tables#99
alies-dev merged 1 commit into
florianv:masterfrom
rob-browncc:add-unirate-api

Conversation

@rob-browncc

Copy link
Copy Markdown
Contributor

Adds UniRateAPI to the Laravel-Swap config stub and the documented provider lists, following the merged work upstream:

SwapServiceProvider builds the chain by iterating the services array in config/swap.php and forwarding each entry to Swap\Builder::add($identifier, $options), which delegates to Exchanger\Service\Registry. Once the next Exchanger release tag publishes, Laravel-Swap users can drop in:

// config/swap.php
'services' => [
    'unirate_api' => ['api_key' => env('SWAP_UNIRATE_API_KEY')],
    // ...
],

…with no further wiring. This PR only updates the published config and the docs.

Changes

  • config/swap.php
    • Adds unirate_api to the in-file docblock spec list (after xchangeapi), matching the existing fastforex / apilayer_fixer / forge blocks.
    • Adds a commented-out 'unirate_api' => ['api_key' => env('SWAP_UNIRATE_API_KEY')] line next to the other commercial-provider examples in services.
  • README.md — adds UniRateAPI row to the commercial provider table (alphabetical, between open_exchange_rates and webservicex); bumps the count 30 → 31.
  • doc/readme.md — adds unirate_api / api_key row to the commercial configuration table.

Notes

  • Identifier unirate_api matches the key in Exchanger\Service\Registry::getServices() after #180; Laravel-Swap doesn't need any code change to pick it up.
  • UniRateAPI is a commercial REST API for FX (170+ currencies, EUR/USD/any base). Latest rates are on the free tier; historical (/api/historical) and commodities are paid-tier only — the upstream UniRateApi.php maps HTTP 403 on those endpoints to Exchanger\Exception\ChainException, matching the existing fastFOREX / Fixer plan-gated behaviour, so the chain falls through cleanly.

Disclosure

I work with UniRateAPI. The implementation work (Exchanger #180) was done first; opening this docs + config-stub PR now that the upstream merge has landed so Laravel users discover the provider through the standard publish flow instead of having to read the changelog. Happy to revise the wording, drop the count bump until the next Exchanger release tag, or split the README/doc changes off from config/swap.php if you'd rather review them separately.

Exchanger merged UniRateAPI support in florianv/exchanger#180 and Swap's
docs PR is florianv/swap#155. Laravel Swap auto-inherits the underlying
Swap service list, so `'unirate_api' => ['api_key' => env(...)]` already
works on master once the next Exchanger release tag lands; only the docs
and the published config stub were missing.

- config/swap.php: add `unirate_api` to the in-file docblock spec list
  (after `xchangeapi`) and add a commented-out example line to the
  `services` array next to the other commercial providers, mirroring
  the existing `apilayer_fixer` / `open_exchange_rates` examples.
- README.md: add `UniRateAPI` row to the commercial provider table
  (alphabetical, between `open_exchange_rates` and `webservicex`);
  bump count 30 → 31.
- doc/readme.md: add `unirate_api` / `api_key` row to the commercial
  configuration table.

UniRateAPI is a commercial REST API for FX. Latest rates are on the
free tier; historical and commodities are paid-tier only — the upstream
`Exchanger\Service\UniRateApi` maps HTTP 403 on those endpoints to
`Exchanger\Exception\ChainException`, matching the existing fastFOREX /
Fixer plan-gated behaviour.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates Laravel Swap’s published config stub and documentation tables to mention the newly added upstream unirate_api provider identifier, so Laravel users can discover/configure UniRateAPI via the standard config/swap.php publish flow.

Changes:

  • Add unirate_api to the commercial providers list in README.md and update the stated provider count.
  • Add unirate_api to the commercial provider configuration table in doc/readme.md.
  • Add a UniRateAPI config-spec example and a commented services entry to config/swap.php.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
README.md Adds UniRateAPI to the commercial providers table and bumps the stated provider count.
doc/readme.md Documents unirate_api required option (api_key) in the provider configuration table.
config/swap.php Adds UniRateAPI to the in-file config spec and provides a commented example services entry.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
## 📊 Providers

Laravel Swap supports the 30 exchange rate providers from the underlying [Swap](https://github.com/florianv/swap) library. Pass the **identifier** as the key under `services` in `config/swap.php`.
Laravel Swap supports the 31 exchange rate providers from the underlying [Swap](https://github.com/florianv/swap) library. Pass the **identifier** as the key under `services` in `config/swap.php`.
Comment thread config/swap.php
| ]
|
| * 'unirate_api' => [
| 'api_key' => 'secret', // The API token. Get a free one at https://unirateapi.com
@rob-browncc

Copy link
Copy Markdown
Contributor Author

Quick note picking up the Copilot suggestions:

Provider count (README, line 107): Same situation as the parallel swap PR (florianv/swap#155) — Exchanger PR #180 merged 2026-05-18 but the last Exchanger release tag (2.9.1) was 2026-05-14, so packagist installs don't ship unirate_api yet. Happy to either:

  1. Merge as-is, count becomes accurate when the next Exchanger tag ships.
  2. Drop the 30 → 31 bump and the count-bump for the Providers line, keeping just the docblock + commented services example + README table row + doc/readme.md row, and open a count-only PR after the next Exchanger release.

Docblock wording (config/swap.php, line 91): Copilot's nit about "Get a free one" wording + missing punctuation is fair — happy to push a small follow-up commit changing it to // Get a free API key at https://unirateapi.com. for consistency with the other commented examples. Just say the word.

No other pending changes on my end.

(UniRateAPI affiliation disclosed in the PR body.)

@alies-dev alies-dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@alies-dev
alies-dev merged commit 2aa646c into florianv:master Jun 17, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants