All Projects → americanexpress → hyperledger-fabric-sdk-php

americanexpress / hyperledger-fabric-sdk-php

Licence: Apache-2.0 License
Client SDK for Hyperledger Fabric for use in PHP applications

Programming Languages

PHP
23972 projects - #3 most used programming language
go
31211 projects - #10 most used programming language
java
68154 projects - #9 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to hyperledger-fabric-sdk-php

Fabric Sdk Java
Stars: ✭ 982 (+2355%)
Mutual labels:  fabric, hyperledger, distributed-ledger
Fabric Sdk Node
Hyperledger Fabric SDK for Node https://wiki.hyperledger.org/display/fabric
Stars: ✭ 676 (+1590%)
Mutual labels:  fabric, hyperledger, distributed-ledger
Fabric Sdk Go
Stars: ✭ 712 (+1680%)
Mutual labels:  hyperledger, hyperledger-fabric, distributed-ledger
bdk
Streamlined blockchain deployment kit for Hyperledger Fabric.
Stars: ✭ 43 (+7.5%)
Mutual labels:  fabric, hyperledger, hyperledger-fabric
Fabric Starter
Starter Application and Deployment Scripts for Hyperledger Fabric
Stars: ✭ 202 (+405%)
Mutual labels:  fabric, hyperledger, hyperledger-fabric
Fabric Gateway Java
Hyperledger Fabric Gateway SDK for Java https://wiki.hyperledger.org/display/fabric
Stars: ✭ 122 (+205%)
Mutual labels:  fabric, hyperledger, distributed-ledger
Fabric Sdk Py
Hyperledger Fabric Python SDK
Stars: ✭ 303 (+657.5%)
Mutual labels:  fabric, hyperledger, distributed-ledger
Fabric
Hyperledger Fabric is an enterprise-grade permissioned distributed ledger framework for developing solutions and applications. Its modular and versatile design satisfies a broad range of industry use cases. It offers a unique approach to consensus that enables performance at scale while preserving privacy.
Stars: ✭ 12,911 (+32177.5%)
Mutual labels:  fabric, hyperledger, distributed-ledger
fabric-token-sdk
The Fabric Token SDK is a set of API and services that lets developers create token-based distributed application on Hyperledger Fabric.
Stars: ✭ 63 (+57.5%)
Mutual labels:  hyperledger, hyperledger-fabric, distributed-ledger
hlf-operator
Hyperledger Fabric Kubernetes operator - Hyperledger Fabric operator for Kubernetes (v2.2+)
Stars: ✭ 112 (+180%)
Mutual labels:  fabric, hyperledger, hyperledger-fabric
Probe
Probe is a web GUI application with for Hyperledger Fabric maintainer, user, research to find the best block config logic for specific chain-code.
Stars: ✭ 29 (-27.5%)
Mutual labels:  fabric, hyperledger-fabric
hurley
The development environment toolset for blockchain projects
Stars: ✭ 79 (+97.5%)
Mutual labels:  hyperledger, hyperledger-fabric
docker-hyperledger-fabric-peer
Docker image for Hyperledger Fabric Peer
Stars: ✭ 25 (-37.5%)
Mutual labels:  hyperledger, hyperledger-fabric
fabric
这是基于fabric 1.4.1 版本国密改造项目
Stars: ✭ 62 (+55%)
Mutual labels:  fabric, hyperledger
byzantine-browser
KHS Blockchain Browser
Stars: ✭ 19 (-52.5%)
Mutual labels:  fabric, hyperledger
hyperledger-fabric-graphql-boilerplate
Hyperledger Fabric GraphQL Boilerplate
Stars: ✭ 44 (+10%)
Mutual labels:  fabric, hyperledger
fabric-cop
This is a read-only mirror of https://gerrit.hyperledger.org/r/#/admin/projects/fabric-cop no pull requests accepted
Stars: ✭ 13 (-67.5%)
Mutual labels:  hyperledger, distributed-ledger
fabric-smart-client
The Fabric Smart Client is a new Fabric Client that lets you focus on the business processes and simplifies the development of Fabric-based distributed application.
Stars: ✭ 40 (+0%)
Mutual labels:  fabric, hyperledger-fabric
heroes-service-network
Short tutorial to build a blockchain network with Hyperledger Fabric
Stars: ✭ 22 (-45%)
Mutual labels:  hyperledger, hyperledger-fabric
HealthLedger
Application for tracking Organs donations in hospitals and minimizing the scope of Organ trafficking using Blockchain (Hyperledger) technology.
Stars: ✭ 29 (-27.5%)
Mutual labels:  hyperledger, hyperledger-fabric

Build Status Coverage Status Scrutinizer Code Quality

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

composer require americanexpress/hyperledger-fabric-sdk-php

Usage

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

Channel::queryByChaincode

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

  • 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 is provided to bring up the test network as per the test cases.

Phase 2 (Upcoming)

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

Latest builds of Fabric and Fabric-ca v1.1.0

Hyperledger Fabric v1.1.0 is currently under active development.

You can clone these projects by going to the Hyperledger repository.


Prerequisites

Docker version ^17.0

Check version of Docker:

docker --version

PHP version ^7.1

Check version of PHP:

php --version

PHP GMP extension

Check PHP-GMP setup in php.ini

Composer tool

Check composer version (it should be 1.5 or plus)

composer --version

Installing SDK (for development)

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

Generating SDK API Documentation

composer docs
open build/docs/index.html

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

Regenerating PHP Class files from .proto files

composer protoc

Read more about compiling PHP code from proto files.

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.

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

License

Any contributions made under this project will be governed by the Apache License 2.0.

Code of Conduct

This project adheres to the American Express Community Guidelines. By participating, you are expected to honor these guidelines.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].