PHPackages                             cbix/toshi-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. cbix/toshi-php

ActiveLibrary[API Development](/categories/api)

cbix/toshi-php
==============

PHP library for the Toshi Bitcoin API

59501PHP

Since Oct 17Pushed 11y agoCompare

[ Source](https://github.com/Digital-Currency-Research/Toshi-PHP)[ Packagist](https://packagist.org/packages/cbix/toshi-php)[ RSS](/packages/cbix-toshi-php/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Toshi-PHP
=========

[](#toshi-php)

[![Build Status](https://camo.githubusercontent.com/b3aa4f50775288c26e258430575614ad667344083e27e0a19c9b25c9df279edc/68747470733a2f2f7472617669732d63692e6f72672f4469676974616c2d43757272656e63792d52657365617263682f546f7368692d5048502e737667)](https://travis-ci.org/Digital-Currency-Research/Toshi-PHP)[![Code Climate](https://camo.githubusercontent.com/852581d8bf024972f39aa8091bc7748b53b1218336a80be952f274e4215ea544/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f4469676974616c2d43757272656e63792d52657365617263682f546f7368692d5048502f6261646765732f6770612e737667)](https://codeclimate.com/github/Digital-Currency-Research/Toshi-PHP)[![Test Coverage](https://camo.githubusercontent.com/4138d5cb46be529fe53debc8b22592c066b2b95b79000ace3239cd9947e2ac1a/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f4469676974616c2d43757272656e63792d52657365617263682f546f7368692d5048502f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/Digital-Currency-Research/Toshi-PHP)

This library provides a simple PHP interface to the [Toshi Bitcoin API](https://toshi.io/).

### Installing via Composer

[](#installing-via-composer)

The recommended way to install the library is through [Composer](http://getcomposer.org).

```
# Install Composer
curl -sS https://getcomposer.org/installer | php

# Add Chain-PHP as a dependency
php composer.phar require cbix/toshi-php:dev-master
```

After installing, you need to require Composer's autoloader:

```
require 'vendor/autoload.php';
```

### Setup

[](#setup)

```
$toshi = Toshi::make();

```

### Blocks

[](#blocks)

The get\_block and get\_block\_transactions methods accept either a block height or block hash

```
$latest_blocks = $toshi->get_latest_blocks();
$latest_block = $toshi->get_latest_block();
$block = $toshi->get_block('00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048');
$block_transactions = $toshi->get_block_transactions('00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048');

```

### Transactions

[](#transactions)

```
$transaction = $toshi->get_transaction('0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098');
$relay_transaction = $toshi->relay_transaction('0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098);
$unconfirmed_transactions = $toshi->unconfirmed_transactions('0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098');

```

### Addresses

[](#addresses)

```
$address_balance = $toshi->get_address_balance('12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX');
$address_transactions = $toshi->get_address_transactions('12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX');
$address_unspent_outputs = $toshi->get_address_unspent_outputs('12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX');

```

### Exceptions

[](#exceptions)

If there are any issues during the API request a ToshiException will be thrown which can be caught and managed according to your application needs.

```
try {
    $latest_block = $toshi->get_latest_block();
    echo $latest_block->height;
} catch (ToshiException $e) {
    //There was an error more information in $e->getMessage();
    var_dump($e->getMessage());
}

```

### Unit Tests

[](#unit-tests)

This library uses PHPUnit for unit testing. In order to run the unit tests, you'll first need to install the dependencies of the project using Composer: `php composer.phar install --dev`. You can then run the tests using `vendor/bin/phpunit`. The library comes with a set of mocked responses from the [Toshi API](https://toshi.io) for running the unit tests.

### Contributions

[](#contributions)

Patches, bug fixes, feature requests, and pull requests are welcome on the GitHub page for this project.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/947d18667b95c03befacd5f20dae7127b954f2cefcbc17e30b8bf031c23ba194?d=identicon)[garethtdavies](/maintainers/garethtdavies)

### Embed Badge

![Health badge](/badges/cbix-toshi-php/health.svg)

```
[![Health](https://phpackages.com/badges/cbix-toshi-php/health.svg)](https://phpackages.com/packages/cbix-toshi-php)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
