1. Go to this page and download the library: Download fenshenx/php-conflux-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
//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
//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));
shell
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.