diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..dc7805e --- /dev/null +++ b/composer.json @@ -0,0 +1,14 @@ +{ + "name": "blockchaintest/blockchaintest", + "description": "Blockchain API client library", + "keywords": ["bitcoin", "blockchain"], + "homepage": ["https://blockchain.info/"], + "license": "MIT", + "autoload": { + "psr-4": { "": "lib/" } + }, + "require": { + "php": ">=5.3.0", + "ext-curl": "*" + } +} diff --git a/lib/Blockchain.php b/lib/Blockchain.php index 851ac84..017c73e 100644 --- a/lib/Blockchain.php +++ b/lib/Blockchain.php @@ -3,8 +3,8 @@ Blockchain PHP API https://github.com/blockchain/api-v1-client-php/ */ - -require_once(__DIR__.'/Blockchain/Exceptions.php'); + +require_once(dirname(__FILE__).'/Blockchain/Exceptions.php'); // Check if BCMath module installed if(!function_exists('bcscale')) { @@ -16,13 +16,13 @@ throw new Blockchain_Error("cURL module not installed."); } -require_once(__DIR__.'/Blockchain/Create.php'); -require_once(__DIR__.'/Blockchain/Explorer.php'); -require_once(__DIR__.'/Blockchain/PushTX.php'); -require_once(__DIR__.'/Blockchain/Rates.php'); -require_once(__DIR__.'/Blockchain/Receive.php'); -require_once(__DIR__.'/Blockchain/Stats.php'); -require_once(__DIR__.'/Blockchain/Wallet.php'); +require_once(dirname(__FILE__).'/Blockchain/Create.php'); +require_once(dirname(__FILE__).'/Blockchain/Explorer.php'); +require_once(dirname(__FILE__).'/Blockchain/PushTX.php'); +require_once(dirname(__FILE__).'/Blockchain/Rates.php'); +require_once(dirname(__FILE__).'/Blockchain/Receive.php'); +require_once(dirname(__FILE__).'/Blockchain/Stats.php'); +require_once(dirname(__FILE__).'/Blockchain/Wallet.php'); class Blockchain { const URL = 'https://blockchain.info/'; @@ -45,7 +45,7 @@ public function __construct($api_code=null) { curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($this->ch, CURLOPT_TIMEOUT, 60); - curl_setopt($this->ch, CURLOPT_CAINFO, __DIR__.'/Blockchain/ca-bundle.crt'); + curl_setopt($this->ch, CURLOPT_CAINFO, dirname(__FILE__).'/Blockchain/ca-bundle.crt'); $this->Create = new Create($this); $this->Explorer = new Explorer($this); @@ -56,7 +56,7 @@ public function __construct($api_code=null) { $this->Wallet = new Wallet($this); } - public function __deconstruct() { + public function __destruct() { curl_close($this->ch); }