PHPackages                             fenshenx/php-conflux-sdk - 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. fenshenx/php-conflux-sdk

ActiveLibrary[API Development](/categories/api)

fenshenx/php-conflux-sdk
========================

Conflux web3 interface

0.1.6(3y ago)060MITPHPPHP 8.\*

Since Nov 28Pushed 3y ago1 watchersCompare

[ Source](https://github.com/FenShenx/php-conflux-sdk)[ Packagist](https://packagist.org/packages/fenshenx/php-conflux-sdk)[ RSS](/packages/fenshenx-php-conflux-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (8)Versions (8)Used By (0)

PHP Conflux SDK
===============

[](#php-conflux-sdk)

Insatall
--------

[](#insatall)

```
composer require fenshenx/php-conflux-sdk
```

Using Conflux
-------------

[](#using-conflux)

- Test Net:  NetworkId:1
- Main Net:  NetworkId:1029

Transaction
-----------

[](#transaction)

```
require_once "vendor/autoload.php";

$conflux = new \Fenshenx\PhpConfluxSdk\Conflux("https://test.confluxrpc.com", 1);

$cfx = $conflux->getCfx();

$account = $conflux->getWallet()->addPrivateKey('0x0000000xxxxxxxxx');  //your private key
$options = [
    'from' => $account->getConfluxAddress(),
    'to' => 'cfxtest:aapr2jm67p5myymb51g0caszkred0907eayz84w6v3',
    'value' => \Fenshenx\PhpConfluxSdk\Drip::fromCFX(1)
];

$gasInfo = $cfx->estimateGasAndCollateral($options);
$hash = $cfx->sendTransaction($options);
```

GetBalance
----------

[](#getbalance)

```
$balance = $cfx->getBalance('cfxtest:aapr2jm67p5myymb51g0caszkred0907eayz84w6v3');
$balanceDrip = $balance->getDrip(); //string
$balanceDripHex = $balance->getDripHex();
$balanceCfx = $balance->toCFX();
```

Contract
--------

[](#contract)

```
$account = $conflux->getWallet()->addPrivateKey('0x00000xxxxx');    //your private key

$contractAddress = "cfxtest:acgh0vts2ga63dpwrbtzcgbz9m4x01bpkjwu9sufp4";
$abi = file_get_contents($contractAddress.'.json');
$contract = $conflux->getContract($abi, $contractAddress);

// Call contract 'balanceOf' method
$balance = $contract->balanceOf("cfxtest:aapr2jm67p5myymb51g0caszkred0907eayz84w6v3")->send();

// Send contract 'mint' transaction
$mintTransactionGas = $contract->mint($account->getConfluxAddress(), 100)->estimateGasAndCollateral($account);
$mintTransactionHash = $contract->mint($account->getConfluxAddress(), 100)->sendTransaction($account);
```

`$conflux->getContract` function return a new `Fenshenx\PhpConfluxSdk\Contract\Contract` class

`$contract->xxxxxxxxx()` return a new `Fenshenx\PhpConfluxSdk\Contract\MethodTransaction` class

Create Account
--------------

[](#create-account)

```
$account = $conflux->getWallet()->addRandom();
```

Utils
-----

[](#utils)

```
//Eth address to conflux address
\Fenshenx\PhpConfluxSdk\Utils\SignUtil::address2ConfluxAddress('0xxxx', 1);

//Conflux address to eth address
\Fenshenx\PhpConfluxSdk\Utils\SignUtil::confluxAddress2Address('cfxtest:acgh0vts2ga63dpwrbtzcgbz9m4x01bpkjwu9sufp4');

//Private key to public key
\Fenshenx\PhpConfluxSdk\Utils\SignUtil::privateKey2PublicKey('0x00xxxxxx');

//Add 0x to string start if the string not start with 0x
\Fenshenx\PhpConfluxSdk\Utils\FormatUtil::zeroPrefix('0abcdef');   //zeroPrefix('0x0abcdef') reutrn 0x0abcdef

//Remove 0x from string if the string start with 0x
\Fenshenx\PhpConfluxSdk\Utils\FormatUtil::stripZero('0x123abcd');   //stripZero('123abcd') return  123abcd
```

Replace default http provider
-----------------------------

[](#replace-default-http-provider)

```
//or
//class MyProvider implements IProvider
class MyProvider extends \Fenshenx\PhpConfluxSdk\Providers\BaseProvider {

    protected function request($data)
    {
        //send the request
    }
}

$confluxWithMyProvider = new \Fenshenx\PhpConfluxSdk\Conflux(url: $rpcUrl, networkId: 1, ownProvider: new MyProvider($rpcUrl));
```

Test
----

[](#test)

```
phpunit
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~9 days

Total

7

Last Release

1200d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/93d8362d6a62e15281845add18843ec5251bbde45a69326b12dab74c981e5d93?d=identicon)[FenShenX](/maintainers/FenShenX)

---

Top Contributors

[![FenShenx](https://avatars.githubusercontent.com/u/29164623?v=4)](https://github.com/FenShenx "FenShenx (243 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fenshenx-php-conflux-sdk/health.svg)

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M647](/packages/sylius-sylius)[wheelpros/fitment-platform-api

Magento 2 (Open Source)

12.1k1.2k](/packages/wheelpros-fitment-platform-api)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)[alexacrm/dynamics-webapi-toolkit

Web API toolkit for Microsoft Dynamics 365 and Dynamics CRM

81324.1k1](/packages/alexacrm-dynamics-webapi-toolkit)[soneso/stellar-php-sdk

Stellar PHP SDK for the Stellar Network

4048.2k4](/packages/soneso-stellar-php-sdk)[tamara-solution/php-sdk

Tamara PHP Client Library

10259.4k1](/packages/tamara-solution-php-sdk)

PHPackages © 2026

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