PHPackages                             jimmerioles/bitcoin-currency-converter-php - 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. jimmerioles/bitcoin-currency-converter-php

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

jimmerioles/bitcoin-currency-converter-php
==========================================

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.

v3.0.0(1y ago)132.7k7[1 issues](https://github.com/jimmerioles/bitcoin-currency-converter-php/issues)MITPHPPHP 8.3.\* || 8.4.\*CI passing

Since Sep 4Pushed 10mo ago2 watchersCompare

[ Source](https://github.com/jimmerioles/bitcoin-currency-converter-php)[ Packagist](https://packagist.org/packages/jimmerioles/bitcoin-currency-converter-php)[ RSS](/packages/jimmerioles-bitcoin-currency-converter-php/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (4)Dependencies (13)Versions (14)Used By (0)

Bitcoin Currency Converter
==========================

[](#bitcoin-currency-converter)

[![Latest Version on Packagist](https://camo.githubusercontent.com/57b61c519d2a3816457b5954c3a25a7093c52e7b45557f65a9f07ab0743c0b42/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a696d6d6572696f6c65732f626974636f696e2d63757272656e63792d636f6e7665727465722d7068702e7376673f7374796c653d666c6174)](https://packagist.org/packages/jimmerioles/bitcoin-currency-converter-php)[![Software License](https://camo.githubusercontent.com/f251623e510f5909f16ae3f4e6e548dac11340b9fde1a99be26b015b39272c00/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c6174)](LICENSE)[![PHP 7.* Tests](https://github.com/jimmerioles/bitcoin-currency-converter-php/actions/workflows/php-tests.yml/badge.svg)](https://github.com/jimmerioles/bitcoin-currency-converter-php/actions/workflows/php-tests.yml)[![Test Coverage](https://camo.githubusercontent.com/9aefefeab1048ae6a344d9cc370bf14dd5141a32d1aafd33c480aba9477d83bd/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f34333834313362653363343034373735383636632f746573745f636f766572616765)](https://codeclimate.com/github/jimmerioles/bitcoin-currency-converter-php/test_coverage)[![Maintainability](https://camo.githubusercontent.com/e8e1fca570902ed93bcae2bc2ec24132e951c1c2031daa75584755ea9eceeb85/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f34333834313362653363343034373735383636632f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/jimmerioles/bitcoin-currency-converter-php/maintainability)[![Total Downloads](https://camo.githubusercontent.com/ffff8a5f542c8567a22ebf1fb75ebd92d09e51b51fc1a58b4a5ba4405319225c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a696d6d6572696f6c65732f626974636f696e2d63757272656e63792d636f6e7665727465722d7068702e7376673f7374796c653d666c6174)](https://packagist.org/packages/jimmerioles/bitcoin-currency-converter-php/stats)

This library helps developers that need to easily convert bitcoin to fiat currency(ISO 4217) or to another cryptocurrency and vice versa from your exchange rates provider of choice.

Available exchange rates providers are:

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

If you have any request for other exchange rates provider or other features that you would like for me to add see [Contributing](https://github.com/jimmerioles/bitcoin-currency-converter-php#contributing).

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)

PHP Versions Support
--------------------

[](#php-versions-support)

Bitcoin Currency ConverterPHP 7.0PHP 7.1PHP 7.2PHP 7.3PHP 7.4PHP 8.0PHP 8.1PHP 8.2PHP 8.3PHP 8.4[original-legacy-codebase](https://github.com/jimmerioles/bitcoin-currency-converter-php/tree/original-legacy-codebase)✅✅[1.x](https://github.com/jimmerioles/bitcoin-currency-converter-php/tree/1.x)✅✅✅✅✅[2.x](https://github.com/jimmerioles/bitcoin-currency-converter-php/tree/2.x)✅✅✅[3.x](https://github.com/jimmerioles/bitcoin-currency-converter-php/tree/master)✅✅Install
-------

[](#install)

Lets begin by installing the library by Composer:

```
$ composer require jimmerioles/bitcoin-currency-converter-php
```

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 Jimmerioles\BitcoinCurrencyConverter\Converter;

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

or you can use the helper function for convenience:

```
// uses Coinbase as default provider
echo to_currency('USD', 0.5); // 2000.00
echo to_currency('LTC', 0.5); // 10.12345678
```

#### 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 Jimmerioles\BitcoinCurrencyConverter\Converter;

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

and it also has its helper function for convenience:

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

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

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

```
use Jimmerioles\BitcoinCurrencyConverter\Converter;
use Jimmerioles\BitcoinCurrencyConverter\Provider\CoinbaseProvider;
use Jimmerioles\BitcoinCurrencyConverter\Provider\CoindeskProvider;
use Jimmerioles\BitcoinCurrencyConverter\Provider\BitpayProvider;

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

or if you prefer to use the helper functions:

```
echo to_currency('USD', 0.5, new CoindeskProvider); // 2000.00
echo to_currency('LTC', 0.5, new BitpayProvider);   // 10.12345678
echo to_btc(100, 'USD', new CoindeskProvider);      // 0.12345678
echo to_btc(20, 'LTC', new BitpayProvider);         // 2.12345678
```

#### 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
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](https://github.com/jimmerioles/bitcoin-currency-converter-php/blob/master/CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ phpunit
```

#### Show full specs and features:

[](#show-full-specs-and-features)

```
$ phpunit --testdox
```

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

[](#contributing)

Open for suggestions and requests. Please request through [issue](https://github.com/jimmerioles/bitcoin-currency-converter-php/issues/new) or [pull requests](https://github.com/jimmerioles/bitcoin-currency-converter-php/pull/new/master).

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Jim Merioles](https://twitter.com/jimmerioles)
- [Contributors](https://github.com/jimmerioles/bitcoin-currency-converter-php/graphs/contributors)

License
-------

[](#license)

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

### Want to show some ❤️?

[](#want-to-show-some-heart)

Let's find Satoshi Nakamoto!or let's have a ☕[![Donate Bitcoin](https://camo.githubusercontent.com/ec93b629bfab3de528a3f329f372ef39e726130210da5221b1e8a46d6a285e8b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f426974636f696e2d314b4254334d7a737232645a716851714e59783467756d38597579643631557a4e6b2d626c75652e7376673f7374796c653d666c6174)](https://camo.githubusercontent.com/ec93b629bfab3de528a3f329f372ef39e726130210da5221b1e8a46d6a285e8b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f426974636f696e2d314b4254334d7a737232645a716851714e59783467756d38597579643631557a4e6b2d626c75652e7376673f7374796c653d666c6174)[![Donate Ethereum](https://camo.githubusercontent.com/e7e5cea1fae510619eda3cd741aacebdba802e7478b5bf48d04bc2928dc36bd1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f457468657265756d2d3078373839364539433431313865343935456237303031613834374242464133433239446663363964392d626c75652e7376673f7374796c653d666c6174)](https://camo.githubusercontent.com/e7e5cea1fae510619eda3cd741aacebdba802e7478b5bf48d04bc2928dc36bd1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f457468657265756d2d3078373839364539433431313865343935456237303031613834374242464133433239446663363964392d626c75652e7376673f7374796c653d666c6174)

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance45

Moderate activity, may be stable

Popularity26

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity88

Battle-tested with a long release history

 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.

###  Release Activity

Cadence

Every ~244 days

Recently: every ~9 days

Total

12

Last Release

529d ago

Major Versions

v0.3.1 → v1.0.02024-12-08

v1.0.0 → v2.0.02024-12-20

1.x-dev → 2.x-dev2024-12-26

2.x-dev → v3.0.02025-01-17

PHP version history (5 changes)v0.1.0PHP &gt;=5.6

v0.2.1PHP &gt;=7.0

v1.0.0PHP ^7.0

v2.0.0PHP 8.0.\* || 8.1.\* || 8.2.\*

v3.0.0PHP 8.3.\* || 8.4.\*

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9766310?v=4)[Jim Merioles](/maintainers/JimMerioles)[@jimmerioles](https://github.com/jimmerioles)

---

Top Contributors

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

---

Tags

bitcoinbitpaycoinbasecoindeskconvertercurrencyexchange-ratesphpcurrencyconverterbitcoincryptocurrencybitpaycoinbasecoindesk

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/jimmerioles-bitcoin-currency-converter-php/health.svg)

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

###  Alternatives

[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9772.3M122](/packages/roots-acorn)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[flarum/core

Delightfully simple forum software.

201.4M2.2k](/packages/flarum-core)[ashallendesign/favicon-fetcher

A Laravel package for fetching website's favicons.

190293.5k3](/packages/ashallendesign-favicon-fetcher)[cartalyst/converter

A framework agnostic measurement conversion and formatting package featuring multiple types of measurements and currency conversion.

88471.0k7](/packages/cartalyst-converter)[ujjwal/currency-converter

Currency Converter Class with features of caching and identifying currency from country Code

49228.8k](/packages/ujjwal-currency-converter)

PHPackages © 2026

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