Skip to content

Commit 9382302

Browse files
committed
Updating the examples to load the composer autoload instead the god class
1 parent da76414 commit 9382302

File tree

7 files changed

+14
-16
lines changed

7 files changed

+14
-16
lines changed

example/create.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<pre><?php
22

3-
require_once('../src/Blockchain.php');
3+
require_once(dirname(__DIR__) . '/vendor/autoload.php');
44

55
$api_code = null;
66
if(file_exists('code.txt')) {
77
$api_code = trim(file_get_contents('code.txt'));
88
}
99

10-
$Blockchain = new Blockchain($api_code);
10+
$Blockchain = new \Blockchain\Blockchain($api_code);
1111

1212
$wallet = $Blockchain->Create->create('weakPassword01!');
1313

example/explorer.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<pre><?php
22

3-
$sRootPath = dirname(__DIR__);
4-
var_dump($sRootPath);
5-
require_once($sRootPath . '/vendor/autoload.php');
3+
require_once(dirname(__DIR__) . '/vendor/autoload.php');
64

75
$api_code = null;
86
if(file_exists('code.txt')) {

example/pushtx.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<pre><?php
22

3-
require_once('../src/Blockchain.php');
3+
require_once(dirname(__DIR__) . '/vendor/autoload.php');
44

55
$api_code = null;
66
if(file_exists('code.txt')) {
77
$api_code = trim(file_get_contents('code.txt'));
88
}
99

10-
$Blockchain = new Blockchain($api_code);
10+
$Blockchain = new \Blockchain\Blockchain($api_code);
1111

1212
// The raw transaction hex for a valid transaction, will not
1313
// send though, since it's an existing transaction

example/rates.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
<body>
1616
<pre><?php
1717

18-
require_once('../src/Blockchain.php');
18+
require_once(dirname(__DIR__) . '/vendor/autoload.php');
1919

2020
$api_code = null;
2121
if(file_exists('code.txt')) {
2222
$api_code = trim(file_get_contents('code.txt'));
2323
}
2424

25-
$Blockchain = new Blockchain($api_code);
25+
$Blockchain = new \Blockchain\Blockchain($api_code);
2626

2727
// Convert a fiat amount to BTC
2828
$amount = $Blockchain->Rates->toBTC(500, 'USD');

example/receive.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<pre><?php
22

3-
require_once('../src/Blockchain.php');
3+
require_once(dirname(__DIR__) . '/vendor/autoload.php');
44

55
$api_code = null;
66
if(file_exists('code.txt')) {
77
$api_code = trim(file_get_contents('code.txt'));
88
}
99

10-
$Blockchain = new Blockchain($api_code);
10+
$Blockchain = new \Blockchain\Blockchain($api_code);
1111

1212
// My receive address
1313
$destination = '1Gr6Y7ZJEmZnbDwopWKJKRTri8fBymPDfg';

example/stats.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<pre><?php
22

3-
require_once('../src/Blockchain.php');
3+
require_once(dirname(__DIR__) . '/vendor/autoload.php');
44

55
$api_code = null;
66
if(file_exists('code.txt')) {
77
$api_code = trim(file_get_contents('code.txt'));
88
}
99

10-
$Blockchain = new Blockchain($api_code);
10+
$Blockchain = new \Blockchain\Blockchain($api_code);
1111

1212
// Get Statistics
1313
$stats = $Blockchain->Stats->get();

example/wallet.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<pre><?php
22

3-
require_once('../src/Blockchain.php');
3+
require_once(dirname(__DIR__) . '/vendor/autoload.php');
44

55
$api_code = null;
66
if(file_exists('code.txt')) {
77
$api_code = trim(file_get_contents('code.txt'));
88
}
99

10-
$Blockchain = new Blockchain($api_code);
10+
$Blockchain = new \Blockchain\Blockchain($api_code);
1111

1212
$wallet_guid = null;
1313
$wallet_pass = null;
@@ -34,7 +34,7 @@
3434
try {
3535
// Uncomment to send
3636
// var_dump($Blockchain->Wallet->send($address, "0.001"));
37-
} catch (Blockchain_ApiError $e) {
37+
} catch (\Blockchain\Exception\ApiError $e) {
3838
echo $e->getMessage() . '<br />';
3939
}
4040

0 commit comments

Comments
 (0)