https://github.com/vaneves/bitcoin-php
🔗 Library for lists of transactions Bitcoin
https://github.com/vaneves/bitcoin-php
bitcoin-api php-library
Last synced: 12 months ago
JSON representation
🔗 Library for lists of transactions Bitcoin
- Host: GitHub
- URL: https://github.com/vaneves/bitcoin-php
- Owner: vaneves
- License: mit
- Created: 2018-02-28T02:18:34.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-02T14:30:23.000Z (over 8 years ago)
- Last Synced: 2025-02-10T12:04:07.497Z (over 1 year ago)
- Topics: bitcoin-api, php-library
- Language: PHP
- Homepage:
- Size: 3.91 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🔗 Query to Bitcoin via PHP
## Installing
Via Composer
```bash
composer require vaneves/bitcoin-php
```
## Usage
### Create Address
Creates a new address.
```php
use Vaneves\Bitcoin\Network;
use Vaneves\Bitcoin\Bitcoin;
use Vaneves\Bitcoin\BitcoinException;
try {
$network = new Network('http://username:password@127.0.0.1:18332');
$bitcoin = new Bitcoin($network);
$address = $bitcoin->account('vaneves')->newAddress();
echo $address;
} catch (BitcoinException $e) {
echo $e->getMessage();
} catch (\Exception $e) {
echo $e->getMessage();
}
```
### List Transactions
List all transactions received and sent.
```php
use Vaneves\Bitcoin\Network;
use Vaneves\Bitcoin\Bitcoin;
use Vaneves\Bitcoin\BitcoinException;
try {
$network = new Network('http://username:password@127.0.0.1:18332');
$bitcoin = new Bitcoin($network);
$offset = 0;
$limit = 100;
$transactions = $bitcoin->transaction()->paginate($offset, $limit);
print_r($transactions);
} catch (BitcoinException $e) {
echo $e->getMessage();
} catch (\Exception $e) {
echo $e->getMessage();
}
```
## License
The MIT License (MIT)
## Donate
Bitcoin address: **1H6ssXbPbLeDVQNf9PqaarTEeG9sjurEgm**
