PHPackages                             oasin/bitcoin-converter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. oasin/bitcoin-converter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

oasin/bitcoin-converter
=======================

Convert Bitcoin to Fiat currency

022PHP

Since Mar 18Pushed 2y ago1 watchersCompare

[ Source](https://github.com/oasin/BitcoinConverter)[ Packagist](https://packagist.org/packages/oasin/bitcoin-converter)[ RSS](/packages/oasin-bitcoin-converter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Bitcoin Converter
=================

[](#bitcoin-converter)

This library helps fintech developers to convert bitcoin to fiat currency or to another cryptocurrency and vice versa.

Available exchange rates providers are:

- [Coinbase](https://www.coinbase.com/charts)
- [Coindesk](https://www.coindesk.com/price)
- [Bitpay](https://bitpay.com/bitcoin-exchange-rates)

Features
--------

[](#features)

It is simple, lightweight, extensible, framework agnostic and fast.

- You can convert Bitcoin to any currency (ISO 4217 fiat or another cryptocurrency)
- You can convert any currency (ISO 4217 fiat or another cryptocurrency) to Bitcoin
- It supports different exchange rates providers: Coinbase, Coindesk, Bitpay
- It has baked-in caching (PSR16 compliant, swappable with your own or your framework's)

Install
-------

[](#install)

Lets begin by installing the library by Composer:

```
$ composer require mitmelon/bitcoin-converter:dev-main
```

Usage
-----

[](#usage)

#### You can then convert Bitcoin to any currency (ISO 4217 fiat or crypto) by:

[](#you-can-then-convert-bitcoin-to-any-currency-iso-4217-fiat-or-crypto-by)

```
use Oasin\BitcoinConverter\Converter;

$convert = new Converter; // uses Coinbase as default provider
echo $convert->toCurrency('USD', 0.5);
echo $convert->toCurrency('LTC', 0.5);
```

#### You can also convert any currency (ISO 4217 fiat or crypto) to Bitcoin:

[](#you-can-also-convert-any-currency-iso-4217-fiat-or-crypto-to-bitcoin)

```
use Oasin\BitcoinConverter\Converter;

$convert = new Converter;         // uses Coinbase as default provider
echo $convert->toBtc(100, 'USD');
echo $convert->toBtc(20, 'LTC');
```

and it also has its helper function for convenience:

```
// uses Coinbase as default provider
echo to_btc(100, 'USD');
echo to_btc(20, 'LTC');
```

#### You can use different exchange rates from providers:

[](#you-can-use-different-exchange-rates-from-providers)

```
use Oasin\BitcoinConverter\Converter;
use Oasin\BitcoinConverter\Provider\CoinbaseProvider;
use Oasin\BitcoinConverter\Provider\CoindeskProvider;
use Oasin\BitcoinConverter\Provider\BitpayProvider;

$convert = new Converter(new CoinbaseProvider);
$convert = new Converter(new CoindeskProvider);
$convert = new Converter(new BitpayProvider);
```

#### You can specify cache expire time (ttl) on provider by:

[](#you-can-specify-cache-expire-time-ttl-on-provider-by)

```
new CoinbaseProvider($httpClient, $psr16CacheImplementation, 5); // cache expires in 5mins, defaults to 60mins
```

Contributing
------------

[](#contributing)

Open for suggestions and requests. Please request through \[issue\]\[link-issue\] or \[pull requests\]\[link-pull-request\].

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity19

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/db213763c367792600e06c2eb22ed6f722e502edcea7d897b371fd312c894bb8?d=identicon)[oasin](/maintainers/oasin)

---

Top Contributors

[![oasin](https://avatars.githubusercontent.com/u/31675779?v=4)](https://github.com/oasin "oasin (4 commits)")

### Embed Badge

![Health badge](/badges/oasin-bitcoin-converter/health.svg)

```
[![Health](https://phpackages.com/badges/oasin-bitcoin-converter/health.svg)](https://phpackages.com/packages/oasin-bitcoin-converter)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
