PHPackages                             birzha76/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. birzha76/bsc-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

birzha76/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

v1.0.2(2y ago)012MITPHPPHP &gt;=8.0

Since Sep 11Pushed 2y agoCompare

[ Source](https://github.com/Birzha76/bsc-php)[ Packagist](https://packagist.org/packages/birzha76/bsc-php)[ Docs](https://github.com/Birzha76/bsc-php)[ RSS](/packages/birzha76-bsc-php/feed)WikiDiscussions master Synced 1mo ago

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

BSC-PHP
=======

[](#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)

```
composer require birzha76/bsc-php
```

### 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 Use
$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

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 77.8% 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 ~0 days

Total

2

Last Release

977d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

phpbinanceBEP20bnb

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/birzha76-bsc-php/health.svg)](https://phpackages.com/packages/birzha76-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

4720.9k](/packages/fenguoz-bsc-php)[stevebauman/location

Retrieve a user's location by their IP Address

1.3k7.6M65](/packages/stevebauman-location)[gehrisandro/tailwind-merge-laravel

TailwindMerge for Laravel merges multiple Tailwind CSS classes by automatically resolving conflicts between them

341682.2k18](/packages/gehrisandro-tailwind-merge-laravel)

PHPackages © 2026

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