PHPackages                             mitmelon/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. mitmelon/bitcoin-converter

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

mitmelon/bitcoin-converter
==========================

A simple and lightweight bitcoin to currency converter and vice versa based on current exchange rates from your chosen provider: Coinbase, Coindesk, Bitpay and etc.

04PHP

Since Mar 12Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/mitmelon/bitcoin-converter)[ Packagist](https://packagist.org/packages/mitmelon/bitcoin-converter)[ RSS](/packages/mitmelon-bitcoin-converter/feed)WikiDiscussions main Synced today

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 Watermelon\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 Watermelon\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 Watermelon\BitcoinConverter\Converter;
use Watermelon\BitcoinConverter\Provider\CoinbaseProvider;
use Watermelon\BitcoinConverter\Provider\CoindeskProvider;
use Watermelon\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

23

—

LowBetter than 26% of packages

Maintenance50

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity27

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/1f05a05a056e93b9cd6513702b8c1af6f6ae71a9c8e288230ec1c10c6ffa3719?d=identicon)[mitmelon](/maintainers/mitmelon)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[fp4php/functional

PHP Functional Programming library

203323.0k10](/packages/fp4php-functional)[arcanedev/php-html

A simple way to create html tags with php.

161.0M6](/packages/arcanedev-php-html)[qazd/text-diff

A simple text differences visualization library

37132.7k1](/packages/qazd-text-diff)[erickskrauch/phpstan-yii2

Yii2 extension for PHPStan

1285.0k5](/packages/erickskrauch-phpstan-yii2)

PHPackages © 2026

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