PHPackages                             jacky50737/bsc-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. jacky50737/bsc-php

ActiveLibrary[API Development](/categories/api)

jacky50737/bsc-php
==================

支援 Binance 的 BNB 和 BEP20，包括地址創建、餘額查詢、交易轉帳、查詢最新區塊鏈、基於區塊鏈查詢資訊以及基於交易哈希查詢資訊等功能

1.0(2y ago)1101MITPHPPHP &gt;=8.0

Since Dec 24Pushed 2y agoCompare

[ Source](https://github.com/jacky50737/bsc-php)[ Packagist](https://packagist.org/packages/jacky50737/bsc-php)[ Docs](https://github.com/jacky50737/bsc-php)[ RSS](/packages/jacky50737-bsc-php/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (1)Dependencies (10)Versions (2)Used By (0)

English | [繁體中文](./README-TW.md) | [简体中文](./README-CN.md)

BSC-PHP
=======

[](#bsc-php)

 [![Stable Version](https://camo.githubusercontent.com/8310a2864bcde74588fbdc81fb087457a334008a98410bbfdc9bb67b849b46af/68747470733a2f2f706f7365722e707567782e6f72672f6a61636b7935303733372f6273632d7068702f762f737461626c65)](https://github.com/jacky50737/bsc-php/releases) [![Php Version](https://camo.githubusercontent.com/c3a80c86d7355ce233d937cc6ce506d4f9b1f34a91fb4b52d2d725a3bef932d0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d2533453d382e312d627269676874677265656e2e7376673f6d61784167653d32353932303030)](https://www.php.net) [![bsc-php License](https://camo.githubusercontent.com/cc910f2910c15d232cbc3439cf8d298973218f47a52d480c9f34a20175d79764/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6a61636b7935303733372f6273632d7068702e7376673f6d61784167653d32353932303030)](https://github.com/jacky50737/bsc-php/blob/master/LICENSE) [![Total Downloads](https://camo.githubusercontent.com/972f25ea40b5c9588c531fd116522ef77489ccb91192cecedf4a95ad5030fc37/68747470733a2f2f706f7365722e707567782e6f72672f6a61636b7935303733372f6273632d7068702f646f776e6c6f616473)](https://packagist.org/packages/jacky50737/bsc-php)

Introduction
------------

[](#introduction)

Support Binance's BNB and BEP20, which include functions such as address creation, balance query, transaction transfer, query the latest blockchain, query information based on the blockchain, and query information based on the transaction hash.

Advantage
---------

[](#advantage)

1. One set of scripts is compatible with all BNB currencies and BEP20 certifications in the BSC network
2. Interface methods can be added or subtracted flexibly

Support Method
--------------

[](#support-method)

### wallet

[](#wallet)

- \*Generate a private key to create an account `newAccountByPrivateKey()`
- \*Generate mnemonic and create an account `newAccountByMnemonic()`
- Restore account using mnemonic `revertAccountByMnemonic(string $mnemonic)`
- Get the address according to the private key `revertAccountByPrivateKey(string $privateKey)`

### Bnb &amp; BEP20

[](#bnb--bep20)

- \*Check balances(BNB) `bnbBalance(string $address)`
- \*Check balances(BEP20) `balance(string $address)`
- Transaction transfer (offline signature) `transfer(string $from, string $to, float $amount)`
- Query the latest block `blockNumber()`
- Query information according to the blockchain `getBlockByNumber(int $blockID)`
- Returns the receipt of a transaction by transaction hash `getTransactionReceipt(string $txHash)`
- \*Returns the information about a transaction requested by transaction hash `getTransactionByHash(string $txHash)`
- \*Query transaction status based on transaction hash `receiptStatus(string $txHash)`

Quick Start
-----------

[](#quick-start)

### Install

[](#install)

PHP8

```
composer require jacky50737/bsc-php
```

or PHP7

```
composer require jacky50737/bsc-php ~1.0
```

### Interface

[](#interface)

#### Wallet

[](#wallet-1)

```
$wallet = new \Binance\Wallet();

// Generate a private key to create an account
$wallet->newAccountByPrivateKey();

// Generate mnemonic and create an account
$wallet->newAccountByMnemonic();

// Restore account using mnemonic
$mnemonic = 'elite link code extra twist autumn flower purse excuse harsh kitchen whip';
$wallet->revertAccountByMnemonic($mnemonic);

// Get the address according to the private key
$privateKey = '5e9340935f4c02628cec5d04cc281012537cafa8dae0e27ff56563b8dffab368';
$wallet->revertAccountByPrivateKey($privateKey);
```

#### Bnb &amp; BEP20

[](#bnb--bep20-1)

```
## Method 1 : BSC RPC Nodes
$uri = 'https://bsc-dataseed1.defibit.io/';// Mainnet
// $uri = 'https://data-seed-prebsc-1-s1.binance.org:8545/';// Testnet
$api = new \Binance\NodeApi($uri);

## Method 2 : Bscscan Api
$apiKey = 'QVG2GK41ASNSD21KJTXUAQ4JTRQ4XUQZCX';
$api = new \Binance\BscscanApi($apiKey);

$bnb = new \Binance\Bnb($api);

$config = [
    'contract_address' => '0x55d398326f99059fF775485246999027B3197955',// USDT BEP20
    'decimals' => 18,
];
$bep20 = new \Binance\BEP20($api, $config);

// *Check balances
$address = '0x1667ca2c72d8699f0c34c55ea00b60eef021be3a';
$bnb->bnbBalance($address);
$bep20->balance($address);

// Transaction transfer (offline signature)
$from = '0x1667ca2c72d8699f0c34c55ea00b60eef021be3a';
$to = '0x1667ca2c72d8699f0c34c55ea00b60eef021****';
$amount = 0.1;
$bnb->transfer($from, $to, $amount);
$bep20->transfer($from, $to, $amount);

// Query the latest block
$bnb->blockNumber();
$bep20->blockNumber();

// Query information according to the blockchain
$blockID = 24631027;
$bnb->getBlockByNumber($blockID);
$bep20->getBlockByNumber($blockID);

// Returns the receipt of a transaction by transaction hash
$txHash = '0x4dd20d01af4c621d2fc293dff17a8fd8403ea3577988bfb245a18bfb6f50604b';
$bnb->getTransactionReceipt($txHash);
$bep20->getTransactionReceipt($txHash);

// Returns the information about a transaction requested by transaction hash
$txHash = '0x4dd20d01af4c621d2fc293dff17a8fd8403ea3577988bfb245a18bfb6f50604b';
$bnb->getTransactionByHash($txHash);
$bep20->getTransactionByHash($txHash);

// Query transaction status based on transaction hash
$txHash = '0x4dd20d01af4c621d2fc293dff17a8fd8403ea3577988bfb245a18bfb6f50604b';
$bnb->receiptStatus($txHash);
$bep20->receiptStatus($txHash);
```

Plan
----

[](#plan)

- Support ERC721|ERC-1155
- Smart Contract

🌟🌟
--

[](#)

[![Stargazers over time](https://camo.githubusercontent.com/49e0c2f0a65b9bbbbafa8a6f9a1884b43ca38db5c7abd233a2b1c8ab1ede2dd1/68747470733a2f2f7374617263686172742e63632f6a61636b7935303733372f6273632d7068702e737667)](https://starchart.cc/jacky50737/bsc-php)

###  Health Score

24

—

LowBetter than 30% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

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

Unknown

Total

1

Last Release

967d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f2866cd2d046ec9ef397215ad35c0a05a0290668645f3da5046cea7e7621d6f3?d=identicon)[jacky50737](/maintainers/jacky50737)

---

Top Contributors

[![Fenguoz](https://avatars.githubusercontent.com/u/28383092?v=4)](https://github.com/Fenguoz "Fenguoz (14 commits)")[![jacky50737](https://avatars.githubusercontent.com/u/27460134?v=4)](https://github.com/jacky50737 "jacky50737 (2 commits)")

---

Tags

phpbinanceBEP20bnb

### Embed Badge

![Health badge](/badges/jacky50737-bsc-php/health.svg)

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

###  Alternatives

[fenguoz/bsc-php

Support Binance's BNB and BEP20, which include functions such as address creation, balance query, transaction transfer, query the latest blockchain, query information based on the blockchain, and query information based on the transaction hash

4533.9k](/packages/fenguoz-bsc-php)[leantime/leantime

Open source project management system for non-project managers. Simple like Trello, powerful like Jira. Built with neurodiversity in mind.

11.3k4.0k](/packages/leantime-leantime)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

762297.9k53](/packages/civicrm-civicrm-core)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.3M49](/packages/tencentcloud-tencentcloud-sdk-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

353.6k](/packages/eslazarev-wildberries-sdk)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.8M672](/packages/shopware-core)

PHPackages © 2026

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