Download the PHP package unirate/slim without Composer

On this page you can find all versions of the php package unirate/slim. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package slim

UniRate for Slim

A Slim Framework 4 integration for the UniRate API — live currency exchange rates, conversion, supported-currency lists, and VAT rates.

It ships three pieces you can use together or separately:

Installation

You also need a PSR-18 HTTP client and PSR-17 factories. For example, with Guzzle:

Get a free API key at unirateapi.com.

Quick start

See examples/app.php for a complete runnable server.

Configuration

UniRateConfig takes the API key and an optional base URL, or build it from an options array:

Routes

registerUniRateRoutes($app, $prefix = '/unirate', ?UniRateClient $client = null) registers four GET routes returning JSON:

Route Query params Response
{prefix}/rate from (default USD), to (optional) {"rate": 0.92} or {"rate": {"EUR": 0.92, …}}
{prefix}/convert from (default USD), to (required), amount (default 1) {"result": 92.5}
{prefix}/currencies — {"currencies": ["USD", "EUR", …]}
{prefix}/vat country (optional) {"vat": {…}}

Route handlers resolve the client from the request attribute set by UniRateMiddleware. If you prefer not to use the middleware, pass the client as the third argument to make the routes self-contained:

Using the client directly

Inside a Slim handler, resolve the client from the request attribute:

Error handling

The client throws UniRate\Slim\UniRateException (base), with the HTTP status as the exception code. Typed subclasses let you catch specific failures:

Status Exception Meaning
400 Exception\InvalidDateException Invalid request parameters
401 Exception\AuthenticationException Missing or invalid API key
403 Exception\ApiException Endpoint requires a Pro subscription
404 Exception\InvalidCurrencyException Currency not found or no data available
429 Exception\RateLimitException Rate limit exceeded
503 Exception\ApiException Service unavailable
other Exception\ApiException Generic API error (status + body)

The registered routes map these to JSON error responses that mirror the API status, e.g. 429 → {"error": "Rate limit exceeded."}.

Historical endpoints (getHistoricalRate) are Pro-gated and return 403 on the free tier.

Rate limits

Free-tier keys are rate limited; a 429 surfaces as RateLimitException.

Testing

The suite mocks all HTTP traffic via php-http/mock-client — no live API calls or key required.

License

MIT — see LICENSE.

Related clients

Part of the official UniRate client family: Python, Node/TypeScript, Swift, Java, Go, Rust, Ruby, PHP, and .NET, plus framework integrations for Laravel, Symfony, Statamic, WordPress, and more.


All versions of slim with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
slim/slim Version ^4.0
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1 || ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package unirate/slim contains the following files

Loading the files please wait ...