PHPackages                             digita1donkey/ethereum-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. digita1donkey/ethereum-php

ActiveLibrary

digita1donkey/ethereum-php
==========================

A library integrating Ethereum with typed PHP

10PHP

Since Nov 8Pushed 6y agoCompare

[ Source](https://github.com/btele/ethereum)[ Packagist](https://packagist.org/packages/digita1donkey/ethereum-php)[ RSS](/packages/digita1donkey-ethereum-php/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

Ethereum-PHP
============

[](#ethereum-php)

is a typed PHP-7.1+ interface to [Ethereum JSON-RPC API](https://github.com/ethereum/wiki/wiki/JSON-RPC).

Check out the latest [API documentation](http://ethereum-php.org/dev/).

### Add library in a [composer.json](https://getcomposer.org/doc/01-basic-usage.md#composer-json-project-setup) file

[](#add-library-in-a-composerjson-file)

```
{
  "minimum-stability":"dev",
  "autoload": {
    "psr-4": {
      "Ethereum\\": "src/"
    }
  },
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/btele/ethereum.git"
    }
  ],
  "require": {
    "digita1donkey/ethereum-php": "dev-master"
  }
}
```

### Usage

[](#usage)

```
composer require digita1donkey/ethereum-php
```

This is the important part of [composer.json](https://github.com/digitaldonkey/ethereum/blob/8.x-1.x/composer.json) in [Drupal Ethereum Module](https://drupal.org/project/ethereum).

```
require __DIR__ . '/vendor/autoload.php';
use Ethereum\Ethereum;

try {
	// Connect to Ganache
    $eth = new Ethereum('http://127.0.0.1:7545');
    // Should return Int 63
    echo $eth->eth_protocolVersion()->val();
}
catch (\Exception $exception) {
    die ("Unable to connect.");
}
```

**Calling Contracts**

You can call (unpayed) functions in smart contracts easily.

The json file "$fileName" used is what you get when you compile a contract with [Truffle](truffleframework.com).

```
$ContractMeta = json_decode(file_get_contents($fileName));
$contract = new SmartContract(
  $ContractMeta->abi,
  $ContractMeta->networks->{NETWORK_ID}->address,
  new Ethereum(SERVER_URL)
);
$someBytes = new EthBytes('34537ce3a455db6b')
$x = $contract->myContractMethod();
echo $x->val()
```

You can also run tests at smart contracts, check out EthTestClient.

### Event listening and handling

[](#event-listening-and-handling)

You can use Ethereum-PHP to watch changed on your smart contracts or index a Blockchain block by block. gs

See [UsingFilters](https://github.com/digitaldonkey/ethereum-php/blob/master/UsingFilters.md) and [ethereum-php-eventlistener](https://github.com/digitaldonkey/ethereum-php-eventlistener).

### Limitations

[](#limitations)

Currently not all datatypes are supported.

This library is read-only for now. This means you can retrieve information stored in Ethereum Blockchain.

To *write* to the blockchain you need a to sign transactions with a private key which is not supported yet.

[![architecture diagram](https://raw.githubusercontent.com/digitaldonkey/ethereum-php/dev/doxygen-assets/ArchitectureDiagrammCS6.png "Drupal Ethereum architecture")](https://raw.githubusercontent.com/digitaldonkey/ethereum-php/dev/doxygen-assets/ArchitectureDiagrammCS6.png)

### Documentation

[](#documentation)

The API documentation is available at [ethereum-php.org](http://ethereum-php.org/).

For reference see the [Ethereum RPC documentation](https://github.com/ethereum/wiki/wiki/JSON-RPC) and for data encoding [RLP dcumentation](https://github.com/ethereum/wiki/wiki/RLP) in [Ethereum Wiki](https://github.com/ethereum/wiki).

There is also a more readable [Ethereum Frontier Guide](http://ethereum.gitbooks.io/frontier-guide/content/rpc.html) version.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 78.8% of commits — single point of failure

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/030814eed08a845384b3c5d4f69506d9932cffe3824ac4ad780e6aeb7581f8d1?d=identicon)[btelle](/maintainers/btelle)

---

Top Contributors

[![digitaldonkey](https://avatars.githubusercontent.com/u/444718?v=4)](https://github.com/digitaldonkey "digitaldonkey (164 commits)")[![owenvoke](https://avatars.githubusercontent.com/u/1899334?v=4)](https://github.com/owenvoke "owenvoke (36 commits)")[![btele](https://avatars.githubusercontent.com/u/34487582?v=4)](https://github.com/btele "btele (4 commits)")[![sebnyc](https://avatars.githubusercontent.com/u/19838972?v=4)](https://github.com/sebnyc "sebnyc (2 commits)")[![antohaby](https://avatars.githubusercontent.com/u/3123432?v=4)](https://github.com/antohaby "antohaby (1 commits)")[![Cryt1c](https://avatars.githubusercontent.com/u/8447640?v=4)](https://github.com/Cryt1c "Cryt1c (1 commits)")

### Embed Badge

![Health badge](/badges/digita1donkey-ethereum-php/health.svg)

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

PHPackages © 2026

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