PHPackages                             americanexpress/hyperledger-fabric-sdk-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. americanexpress/hyperledger-fabric-sdk-php

ArchivedLibrary[API Development](/categories/api)

americanexpress/hyperledger-fabric-sdk-php
==========================================

Hyperledger Fabric client SDK in PHP

0.1.1(8y ago)481.3k19[2 issues](https://github.com/americanexpress/hyperledger-fabric-sdk-php/issues)Apache-2.0PHPPHP ^7.1

Since Dec 7Pushed 8y ago1 watchersCompare

[ Source](https://github.com/americanexpress/hyperledger-fabric-sdk-php)[ Packagist](https://packagist.org/packages/americanexpress/hyperledger-fabric-sdk-php)[ Docs](http://americanexpress.io/)[ RSS](/packages/americanexpress-hyperledger-fabric-sdk-php/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (2)Dependencies (12)Versions (2)Used By (0)

[![Build Status](https://camo.githubusercontent.com/797f6ce4c3bfe70321f55d45ee5df8bd8c4666cc42ea81c2b79af7e875804cb9/68747470733a2f2f7472617669732d63692e6f72672f616d65726963616e657870726573732f68797065726c65646765722d6661627269632d73646b2d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/americanexpress/hyperledger-fabric-sdk-php)[![Coverage Status](https://camo.githubusercontent.com/f03cafbf60204ee65ce7ab0e4f80922830615cbcba64c44677e501c16474b004/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f616d65726963616e657870726573732f68797065726c65646765722d6661627269632d73646b2d7068702f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/r/americanexpress/hyperledger-fabric-sdk-php?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/460b65b3aa2b503e4bcde5071b80114fd9d2c22b594eaa4469917d14f7e7a7f2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616d65726963616e657870726573732f68797065726c65646765722d6661627269632d73646b2d7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/americanexpress/hyperledger-fabric-sdk-php/?branch=master)

Hyperledger Fabric Client SDK for PHP
=====================================

[](#hyperledger-fabric-client-sdk-for-php)

---

Welcome to PHP SDK for Hyperledger project. The main objective of this SDK is to facilitate a client to perform basic chaincode related operations like: creating a channel, installing and accessing a chaincode etc.

Note, the fabric-sdk-php is a standalone client side interface to access the network information and ledger data over running blockchain network, it cannot be used as a persistence medium for application defined channels data.

Installation
------------

[](#installation)

```
composer require americanexpress/hyperledger-fabric-sdk-php

```

Usage
-----

[](#usage)

Below, you will find high-level and concise snippets of code demonstrating how to interact with this SDK.

### Channel::queryByChaincode

[](#channelquerybychaincode)

Query first peer in first organization (default behavior):

```
$config = new \AmericanExpress\HyperledgerFabricClient\Config\ClientConfig([
    // See `test/integration/config.php` for an example.
]);
$response = \AmericanExpress\HyperledgerFabricClient\Client\ClientFactory::fromConfig($config)
    ->getChannel('foo')
    ->getChaincode('example_cc')
    ->invoke('query', 'a');
```

Query specific organization:

```
$config = new \AmericanExpress\HyperledgerFabricClient\Config\ClientConfig([
    // See `test/integration/config.php` for an example.
]);
$response = \AmericanExpress\HyperledgerFabricClient\Client\ClientFactory::fromConfig($config, 'peerOrg1')
    ->getChannel('foo')
    ->getChaincode('example_cc')
    ->invoke('query', 'a');
```

Query specific organization and peer:

```
$config = new \AmericanExpress\HyperledgerFabricClient\Config\ClientConfig([
    // See `test/integration/config.php` for an example.
]);
$options = new \AmericanExpress\HyperledgerFabricClient\Transaction\TransactionOptions([
    'peer' => 'peer1',
]);
$response = \AmericanExpress\HyperledgerFabricClient\Client\ClientFactory::fromConfig($config, 'peerOrg1')
    ->getChannel('foo')
    ->getChaincode('example_cc')
    ->invoke('query', 'a', $options);
```

Query chaincode by path and version:

```
$config = new \AmericanExpress\HyperledgerFabricClient\Config\ClientConfig([
    // See `test/integration/config.php` for an example.
]);
$response = \AmericanExpress\HyperledgerFabricClient\Client\ClientFactory::fromConfig($config)
    ->getChannel('foo')
    ->getChaincode(['name' => 'example_cc', 'version' => '1', 'path' => 'github.com/example_cc'])
    ->invoke('query', 'a');
```

Phase 1
-------

[](#phase-1)

- For phase 1, we are providing client access for basic chaincode operations like query by chain code.
- It’s assumed that we have a running blockchain network, with a predefined channel and an installed chaincode.
- A [predefined script](test/fixture/sdkintegration/docker-compose.yaml) is provided to bring up the test network as per the test cases.

Phase 2 (Upcoming)
------------------

[](#phase-2-upcoming)

- In next release we are targeting to add more chaincode operations like create channel, invoke &amp; install etc

Latest builds of Fabric and Fabric-ca v1.1.0
--------------------------------------------

[](#latest-builds-of-fabric-and-fabric-ca-v110)

Hyperledger Fabric v1.1.0 is currently under active development.

You can clone these projects by going to the [Hyperledger repository](https://gerrit.hyperledger.org/r/#/admin/projects/).

---

### Prerequisites

[](#prerequisites)

#### [Docker version ^17.0](https://docs.docker.com/engine/installation)

[](#docker-version-170)

Check version of Docker:

```
docker --version
```

#### [PHP version ^7.1](http://php.net/manual/en/install.php)

[](#php-version-71)

Check version of PHP:

```
php --version
```

#### [PHP GMP extension](http://php.net/manual/en/gmp.installation.php)

[](#php-gmp-extension)

Check PHP-GMP setup in php.ini

#### [Composer tool](https://getcomposer.org/doc/00-intro.md)

[](#composer-tool)

Check composer version (it should be 1.5 or plus)

```
composer --version
```

### Installing SDK (for development)

[](#installing-sdk-for-development)

```
git clone https://github.com/americanexpress/hyperledger-fabric-sdk-php && cd $_
composer update
```

### Generating SDK API Documentation

[](#generating-sdk-api-documentation)

```
composer docs
```

```
open build/docs/index.html
```

### Running the End2End test case

[](#running-the-end2end-test-case)

Before running the tests, we need to bring up the fabric network and fixture(s):

```
composer fixture:up
```

At present, we are providing example test case for Querying a chaincode, which can be run as below:

```
composer test:integration
```

After running the tests, feel free to bring down the fabric network:

```
composer fixture:down
```

Read more about [Docker Compose](https://docs.docker.com/compose/overview/)

Regenerating PHP Class files from `.proto` files
------------------------------------------------

[](#regenerating-php-class-files-from-proto-files)

```
composer protoc
```

Read more about [compiling PHP code from proto files](docs/compile-hyperledger-fabric-proto-files.md).

Contributing
------------

[](#contributing)

We welcome Your interest in the American Express Open Source Community on Github. Any Contributor to any Open Source Project managed by the American Express Open Source Community must accept and sign an Agreement indicating agreement to the terms below. Except for the rights granted in this Agreement to American Express and to recipients of software distributed by American Express, You reserve all right, title, and interest, if any, in and to Your Contributions. Please [fill out the Agreement](https://cla-assistant.io/americanexpress/hyperledger-fabric-sdk-php).

Please feel free to open pull requests and see `CONTRIBUTING.md` for commit formatting details.

License
-------

[](#license)

Any contributions made under this project will be governed by the [Apache License 2.0](LICENSE.txt).

Code of Conduct
---------------

[](#code-of-conduct)

This project adheres to the [American Express Community Guidelines](CODE_OF_CONDUCT.md). By participating, you are expected to honor these guidelines.

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 63% 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.

###  Release Activity

Cadence

Every ~1 days

Total

2

Last Release

3128d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1569850?v=4)[Tim Klever](/maintainers/tklever)[@tklever](https://github.com/tklever)

---

Top Contributors

[![abacaphiliac](https://avatars.githubusercontent.com/u/1656273?v=4)](https://github.com/abacaphiliac "abacaphiliac (109 commits)")[![tklever](https://avatars.githubusercontent.com/u/1569850?v=4)](https://github.com/tklever "tklever (34 commits)")[![kumarashishgarg](https://avatars.githubusercontent.com/u/16911874?v=4)](https://github.com/kumarashishgarg "kumarashishgarg (15 commits)")[![anikets43](https://avatars.githubusercontent.com/u/7136799?v=4)](https://github.com/anikets43 "anikets43 (8 commits)")[![dnsha](https://avatars.githubusercontent.com/u/29220206?v=4)](https://github.com/dnsha "dnsha (6 commits)")[![adoley](https://avatars.githubusercontent.com/u/29274106?v=4)](https://github.com/adoley "adoley (1 commits)")

---

Tags

blockchaindistributed-ledgerfabrichyperledgerhyperledger-fabricphpsdkgRPCprotobuffabrichyperledger

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/americanexpress-hyperledger-fabric-sdk-php/health.svg)

```
[![Health](https://phpackages.com/badges/americanexpress-hyperledger-fabric-sdk-php/health.svg)](https://phpackages.com/packages/americanexpress-hyperledger-fabric-sdk-php)
```

###  Alternatives

[google/gax

Google API Core for PHP

267116.3M567](/packages/google-gax)[googleads/google-ads-php

Google Ads API client for PHP

3508.5M12](/packages/googleads-google-ads-php)[clarifai/clarifai-php-grpc

Clarifai PHP gRPC client

1229.6k](/packages/clarifai-clarifai-php-grpc)[temporal/sdk

Temporal SDK

4072.9M25](/packages/temporal-sdk)[metaseller/tinkoff-invest-api-v2-php

Unofficial PHP SDK for T-Invest API v2

256.8k3](/packages/metaseller-tinkoff-invest-api-v2-php)[yoti/yoti-php-sdk

Yoti SDK for quickly integrating your PHP backend with Yoti

28578.9k1](/packages/yoti-yoti-php-sdk)

PHPackages © 2026

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