{"id":13650618,"url":"https://github.com/blocktrail/blocktrail-sdk-php","last_synced_at":"2025-04-07T14:15:02.868Z","repository":{"id":21581821,"uuid":"24901786","full_name":"blocktrail/blocktrail-sdk-php","owner":"blocktrail","description":"BlockTrail's Developer Friendly PHP SDK for the BlockTrail API","archived":false,"fork":false,"pushed_at":"2024-04-28T20:33:33.000Z","size":1686,"stargazers_count":46,"open_issues_count":37,"forks_count":48,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-31T12:06:27.412Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/blocktrail.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2014-10-07T17:14:42.000Z","updated_at":"2025-02-19T17:00:15.000Z","dependencies_parsed_at":"2024-06-18T18:19:08.900Z","dependency_job_id":"f80a1f1b-257e-4f44-84b9-b96c84006ed8","html_url":"https://github.com/blocktrail/blocktrail-sdk-php","commit_stats":{"total_commits":436,"total_committers":10,"mean_commits":43.6,"dds":"0.49082568807339455","last_synced_commit":"74c8fb3f50bec1f391b19497f2807c0b6c497a10"},"previous_names":[],"tags_count":69,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blocktrail%2Fblocktrail-sdk-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blocktrail%2Fblocktrail-sdk-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blocktrail%2Fblocktrail-sdk-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blocktrail%2Fblocktrail-sdk-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blocktrail","download_url":"https://codeload.github.com/blocktrail/blocktrail-sdk-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247666015,"owners_count":20975788,"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":[],"created_at":"2024-08-02T02:00:38.504Z","updated_at":"2025-04-07T14:15:02.824Z","avatar_url":"https://github.com/blocktrail.png","language":"PHP","funding_links":[],"categories":["PHP Libraries","Ruby Tools","awesome Bitcoin"],"sub_categories":["E-Books"],"readme":"BlockTrail PHP SDK\n==================\nThis is the BlockTrail PHP SDK. This SDK contains methods for easily interacting with the BlockTrail API.\nBelow are examples to get you started. For additional examples, please see our official documentation\nat https://dev.btc.com/docs/php\n\n\n[![Latest Stable Version](https://poser.pugx.org/blocktrail/blocktrail-sdk/v/stable.svg)](https://packagist.org/packages/blocktrail/blocktrail-sdk)\n[![Latest Unstable Version](https://poser.pugx.org/blocktrail/blocktrail-sdk/v/unstable.svg)](https://packagist.org/packages/blocktrail/blocktrail-sdk)\n[![License](https://poser.pugx.org/blocktrail/blocktrail-sdk/license.svg)](https://packagist.org/packages/blocktrail/blocktrail-sdk)\n\n[![Build Status](https://travis-ci.org/blocktrail/blocktrail-sdk-php.svg?branch=master)](https://travis-ci.org/blocktrail/blocktrail-sdk-php)\n\nUpgrading from v2.x to v3.0.0\n-----------------------------\n**IMPORTANT** `v3.0.0` introduces a new **DEFAULT** wallet encryption, please make sure you upgrade the SDK everywhere you're using it!!\n\nUpgrading from v1.x to v2.0.0\n-----------------------------\n**IMPORTANT** `v2.0.0` has a few BC breaks, please check [docs/CHANGELOG.md](docs/CHANGELOG.md)!!\n\nUpgrading from v1.2.x to v1.3.0\n-----------------------------\n**IMPORTANT** `v1.3.0` adds the option to choose a fee strategy and **by default chooses DYNAMIC**, please check [docs/CHANGELOG.md](docs/CHANGELOG.md) for the details!!\n\nIMPORTANT! FLOATS ARE EVIL!!\n----------------------------\nAs is best practice with financial data, The API returns all values as an integer, the Bitcoin value in Satoshi's.\n**In PHP even more than in other languages it's really easy to make mistakes whem converting from float to integer etc!**\n\nWhen doing so it's really important that you use the `bcmath` or `gmp` libraries to avoid weird rounding errors!\nThe BlockTrail SDK has some easy to use functions to do this for you, we recommend using these\nand we also **strongly** recommend doing all Bitcoin calculation and storing of data in integers\nand only convert to/from Bitcoin float values for displaying it to the user.\n\n```php\nuse Blocktrail\\SDK\\BlocktrailSDK;\n\necho \"123456789 Satoshi to BTC: \" . BlocktrailSDK::toBTC(123456789) . \" \\n\";\necho \"1.23456789 BTC to Satoshi: \" . BlocktrailSDK::toSatoshi(1.23456789) . \" \\n\";\n\n```\n\nA bit more about this can be found [in our documentation](https://dev.btc.com/docs/php).\n\nRequirements\n------------\nThe SDK requires PHP 5.6+ and the Intl, GMP and BCMath PHP extensions.  \nTo install these on Ubuntu use:\n```\nsudo apt-get install php5-bcmath php5-intl php5-gmp\nsudo php5enmod mcrypt\n```\n*BCMath should already be part of the default php5 package*\n\n***On Windows*** you need to uncomment the extensions in your `php.ini` if they are not already enabled:\n```\nextension=php_intl.dll  \nextension=php_gmp.dll  \n```\n\nInstallation\n------------\nTo install the SDK, you will need to be using [Composer](http://getcomposer.org/) in your project.\nIf you aren't using Composer yet, it's really simple! Here's how to install composer and the BlockTrail PHP SDK.\n\n```\n# Install Composer\ncurl -sS https://getcomposer.org/installer | php\n\n# Add the BlockTrail SDK as a dependency\nphp composer.phar require blocktrail/blocktrail-sdk\n``` \n\nNext, require Composer's autoloader, in your application, to automatically load the BlockTrail SDK in your project:\n```PHP\nrequire 'vendor/autoload.php';\nuse Blocktrail\\SDK\\BlocktrailSDK;\n```\n\nOr if put the following in your `composer.json`:\n```\n\"blocktrail/blocktrail-sdk\": \"1.2.*\"\n```\n\n\n***Windows Developers***  \nA note for windows developers: you may encounter an issue in php with cURL and SSL certificates, where cURL is unable to verify a server's cert with a CA ((error 60)[http://curl.haxx.se/libcurl/c/libcurl-errors.html]).  \nToo often the suggested solution is to disable ssl cert verification in cURL, but this completely defeats the point of using SSL. Instead you should take two very simple steps to solve the issue permanently:  \n\n1. download `cacert.pem` from the [curl website](http://curl.haxx.se/docs/caextract.html). This is a bundle of trusted CA root certs extracted from mozilla.org. Save it in a folder within your php installation.  \n2. open your `php.ini` and add/edit the following line (use an absolute path to where you placed the cert bundle):  \n  ```\n  curl.cainfo = C:\\php\\certs\\cacert.pem\n  ```\n\n(Optional) Use `libsecp256k1`\n-----------------------------\nThe underlying `bitcoin-php` library that is used to sign transactions can use `libsecp256k1` for (A LOT) faster signing of transactions.\nIf the `secp256k1-php` PHP extension is installed it will be automatically used and will greatly improve performance!\n\nThe installation is a bit cumbersome though and because `libsecp256k1` still changes a lot building might not always work!\nIf you can get it to install; AWESOME, if not, have patience while we're working on figuring out how to provide installers for them.\n\nhttps://github.com/Bit-Wasp/secp256k1-php#to-install\n\n**MAKE SURE TO RUN THE TESTSUITE OF `secp256k1-php` AFTER THE INSTALL BEFORE ENABLING THE EXTENSION!!**\n\nUsage\n-----\nPlease visit our official documentation at https://dev.btc.com/docs/php for the usage.\n\nSupport and Feedback\n--------------------\nBe sure to visit the BlockTrail API official [documentation website](https://dev.btc.com/docs/php)\nfor additional information about our API.\n\nIf you find a bug, please submit the issue in Github directly. \n[BlockTrail-PHP-SDK Issues](https://github.com/blocktrail/blocktrail-sdk-php/issues)\n\nIf you need additional assistance, contact one of our developers at [support@btc.com](mailto:support@btc.com).\n\nUnit Tests and Coding Style\n---------------------------\nThe project follows the PSR2 coding style, which can easily be validated with `./vendor/bin/phpcs --standard=./phpcs.xml -n -a ./src/`.\nUnit Tests are created with PHPunit and can be ran with `./vendor/bin/phpunit`\n\nRelease\n-------\n```sh\n# make sure you've committed everything?\ngit status\n\n# desired new tag\nTAG=\"v1.1.1\"\n\n# strips off the v from your input\nTAG=$(echo $TAG | sed 's/^v//g')\n\n# update version number in src/Blocktrail.php\nsed -i 's/const SDK_VERSION = \"[0-9].[0-9].[0-9]\";/const SDK_VERSION = \"'$TAG'\";/g' src/Blocktrail.php\n\n# commit the updated version number\ngit commit -am \"release v${TAG}\"\n\n# tag the version\ngit tag v$TAG\n\n# push\ngit push\ngit push --tags\n```\n\nLicense\n-------\nThe BlockTrail PHP SDK is released under the terms of the MIT license. See LICENCE.md for more information or see http://opensource.org/licenses/MIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblocktrail%2Fblocktrail-sdk-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblocktrail%2Fblocktrail-sdk-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblocktrail%2Fblocktrail-sdk-php/lists"}