{"id":19345209,"url":"https://github.com/jimmerioles/bitcoin-currency-converter-php","last_synced_at":"2025-04-23T04:36:27.536Z","repository":{"id":55891801,"uuid":"102385272","full_name":"jimmerioles/bitcoin-currency-converter-php","owner":"jimmerioles","description":"A simple, lightweight, extensible and fast bitcoin to currency converter and vice versa based on current exchange rates from your chosen provider: Coinbase, Coindesk, Bitpay and etc.","archived":false,"fork":false,"pushed_at":"2025-02-16T04:56:47.000Z","size":140,"stargazers_count":13,"open_issues_count":1,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-02T08:22:23.678Z","etag":null,"topics":["bitcoin","bitpay","coinbase","coindesk","converter","currency","exchange-rates","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jimmerioles.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-04T17:22:19.000Z","updated_at":"2025-02-16T04:56:50.000Z","dependencies_parsed_at":"2024-12-08T21:28:00.278Z","dependency_job_id":"8a352af0-ed78-478d-9e6e-34d38e3b97c4","html_url":"https://github.com/jimmerioles/bitcoin-currency-converter-php","commit_stats":{"total_commits":46,"total_committers":1,"mean_commits":46.0,"dds":0.0,"last_synced_commit":"e653ec4e05ebd2aa016987c598b838da28899d24"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimmerioles%2Fbitcoin-currency-converter-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimmerioles%2Fbitcoin-currency-converter-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimmerioles%2Fbitcoin-currency-converter-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimmerioles%2Fbitcoin-currency-converter-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jimmerioles","download_url":"https://codeload.github.com/jimmerioles/bitcoin-currency-converter-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250372462,"owners_count":21419719,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitcoin","bitpay","coinbase","coindesk","converter","currency","exchange-rates","php"],"created_at":"2024-11-10T04:05:26.732Z","updated_at":"2025-04-23T04:36:27.516Z","avatar_url":"https://github.com/jimmerioles.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bitcoin Currency Converter\n\n[![Latest Version on Packagist][ico-version]][link-packagist]\n[![Software License][ico-license]](LICENSE)\n[![PHP 7.* Tests][ico-github-actions]][link-github-actions]\n[![Test Coverage][ico-coverage]][link-coverage]\n[![Maintainability][ico-maintainability]][link-maintainability]\n[![Total Downloads][ico-downloads]][link-downloads]\n\nThis 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.\n\nAvailable exchange rates providers are:\n* [Coinbase][link-coinbase-rates]\n* [Coindesk][link-coindesk-rates]\n* [Bitpay][link-bitpay-rates]\n\nIf you have any request for other exchange rates provider or other features that you would like for me to add see [Contributing][link-contributing].\n\n## Features\n\nIt is simple, lightweight, extensible, framework agnostic and fast.\n\n* You can convert Bitcoin to any currency (ISO 4217 fiat or another cryptocurrency)\n* You can convert any currency (ISO 4217 fiat or another cryptocurrency) to Bitcoin\n* It supports different exchange rates providers: Coinbase, Coindesk, Bitpay\n* It has baked-in caching (PSR16 compliant, swappable with your own or your framework's)\n\n## PHP Versions Support\n\n| Bitcoin Currency Converter | \u003cspan style=\"color: rgb(255,51,51);\"\u003ePHP 7.0\u003c/span\u003e | PHP 7.1 | PHP 7.2 | PHP 7.3 | PHP 7.4 | PHP 8.0 | PHP 8.1 | PHP 8.2 | PHP 8.3 | PHP 8.4 |\n| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: |\n| [original-legacy-codebase][link-original-legacy-codebase] | :white_check_mark: | :white_check_mark: |    |    |    |    |    |    |    |    |\n| [1.x][link-1-x] | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |    |    |    |    |    |\n| [2.x][link-2-x] |    |    |    |    |    | :white_check_mark: | :white_check_mark: | :white_check_mark: |    |    |\n| [3.x][link-3-x] |    |    |    |    |    |    |    |    | :white_check_mark: | :white_check_mark: |\n\n## Install\n\nLets begin by installing the library by Composer:\n\n``` bash\n$ composer require jimmerioles/bitcoin-currency-converter-php\n```\n\n## Usage\n\n#### You can then convert Bitcoin to any currency (ISO 4217 fiat or crypto) by:\n\n``` php\nuse Jimmerioles\\BitcoinCurrencyConverter\\Converter;\n\n$convert = new Converter;              // uses Coinbase as default provider\necho $convert-\u003etoCurrency('USD', 0.5); // 2000.00\necho $convert-\u003etoCurrency('LTC', 0.5); // 10.12345678\n```\n\nor you can use the helper function for convenience:\n\n``` php\n// uses Coinbase as default provider\necho to_currency('USD', 0.5); // 2000.00\necho to_currency('LTC', 0.5); // 10.12345678\n```\n\n#### You can also convert any currency (ISO 4217 fiat or crypto) to Bitcoin:\n\n``` php\nuse Jimmerioles\\BitcoinCurrencyConverter\\Converter;\n\n$convert = new Converter;         // uses Coinbase as default provider\necho $convert-\u003etoBtc(100, 'USD'); // 0.12345678\necho $convert-\u003etoBtc(20, 'LTC');  // 1.12345678\n```\n\nand it also has its helper function for convenience:\n\n``` php\n// uses Coinbase as default provider\necho to_btc(100, 'USD'); // 0.12345678\necho to_btc(20, 'LTC');  // 2.12345678\n```\n\n#### You can use different exchange rates from providers:\n\n``` php\nuse Jimmerioles\\BitcoinCurrencyConverter\\Converter;\nuse Jimmerioles\\BitcoinCurrencyConverter\\Provider\\CoinbaseProvider;\nuse Jimmerioles\\BitcoinCurrencyConverter\\Provider\\CoindeskProvider;\nuse Jimmerioles\\BitcoinCurrencyConverter\\Provider\\BitpayProvider;\n\n$convert = new Converter(new CoinbaseProvider);\n$convert = new Converter(new CoindeskProvider);\n$convert = new Converter(new BitpayProvider);\n```\n\nor if you prefer to use the helper functions:\n\n``` php\necho to_currency('USD', 0.5, new CoindeskProvider); // 2000.00\necho to_currency('LTC', 0.5, new BitpayProvider);   // 10.12345678\necho to_btc(100, 'USD', new CoindeskProvider);      // 0.12345678\necho to_btc(20, 'LTC', new BitpayProvider);         // 2.12345678\n```\n\n#### You can specify cache expire time (ttl) on provider by:\n\n``` php\nnew CoinbaseProvider($httpClient, $psr16CacheImplementation, 5); // cache expires in 5mins, defaults to 60mins\n```\n\n## Change log\n\nPlease see [CHANGELOG][link-changelog] for more information on what has changed recently.\n\n## Testing\n\n``` bash\n$ phpunit\n```\n\n#### Show full specs and features:\n\n``` bash\n$ phpunit --testdox\n```\n\n## Contributing\n\nOpen for suggestions and requests. Please request through [issue][link-issue] or [pull requests][link-pull-request].\n\n## Security\n\nIf you discover any security related issues, please email jimwisleymerioles@gmail.com instead of using the issue tracker.\n\n## Credits\n\n- [Jim Merioles][link-author]\n- [Contributors][link-contributors]\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n\n### Want to show some :heart:?\n\nLet's find Satoshi Nakamoto! | or let's have a :coffee:\n------------ | ------------\n![Donate Bitcoin][ico-bitcoin] | ![Donate Ethereum][ico-ethereum]\n\n\n[ico-version]: https://img.shields.io/packagist/v/jimmerioles/bitcoin-currency-converter-php.svg?style=flat\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat\n[ico-github-actions]: https://github.com/jimmerioles/bitcoin-currency-converter-php/actions/workflows/php-tests.yml/badge.svg\n[ico-coverage]: https://api.codeclimate.com/v1/badges/438413be3c404775866c/test_coverage\n[ico-maintainability]: https://api.codeclimate.com/v1/badges/438413be3c404775866c/maintainability\n[ico-downloads]: https://img.shields.io/packagist/dt/jimmerioles/bitcoin-currency-converter-php.svg?style=flat\n[ico-bitcoin]: https://img.shields.io/badge/Bitcoin-1KBT3Mzsr2dZqhQqNYx4gum8Yuyd61UzNk-blue.svg?style=flat\n[ico-ethereum]: https://img.shields.io/badge/Ethereum-0x7896E9C4118e495Eb7001a847BBFA3C29Dfc69d9-blue.svg?style=flat\n\n[link-packagist]: https://packagist.org/packages/jimmerioles/bitcoin-currency-converter-php\n[link-github-actions]: https://github.com/jimmerioles/bitcoin-currency-converter-php/actions/workflows/php-tests.yml\n[link-coverage]: https://codeclimate.com/github/jimmerioles/bitcoin-currency-converter-php/test_coverage\n[link-maintainability]: https://codeclimate.com/github/jimmerioles/bitcoin-currency-converter-php/maintainability\n[link-downloads]: https://packagist.org/packages/jimmerioles/bitcoin-currency-converter-php/stats\n[link-author]: https://twitter.com/jimmerioles\n[link-contributors]: https://github.com/jimmerioles/bitcoin-currency-converter-php/graphs/contributors\n[link-coinbase-rates]: https://www.coinbase.com/charts\n[link-coindesk-rates]: https://www.coindesk.com/price\n[link-bitpay-rates]: https://bitpay.com/bitcoin-exchange-rates\n[link-changelog]: https://github.com/jimmerioles/bitcoin-currency-converter-php/blob/master/CHANGELOG.md\n[link-issue]: https://github.com/jimmerioles/bitcoin-currency-converter-php/issues/new\n[link-pull-request]: https://github.com/jimmerioles/bitcoin-currency-converter-php/pull/new/master\n[link-contributing]: https://github.com/jimmerioles/bitcoin-currency-converter-php#contributing\n[link-original-legacy-codebase]: https://github.com/jimmerioles/bitcoin-currency-converter-php/tree/original-legacy-codebase\n[link-1-x]: https://github.com/jimmerioles/bitcoin-currency-converter-php/tree/1.x\n[link-2-x]: https://github.com/jimmerioles/bitcoin-currency-converter-php/tree/2.x\n[link-3-x]: https://github.com/jimmerioles/bitcoin-currency-converter-php/tree/master","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimmerioles%2Fbitcoin-currency-converter-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjimmerioles%2Fbitcoin-currency-converter-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimmerioles%2Fbitcoin-currency-converter-php/lists"}