PHPackages                             adman9000/laravel-binance - 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. adman9000/laravel-binance

ActiveLibrary[API Development](/categories/api)

adman9000/laravel-binance
=========================

Laravel implementation of the Binance crypto exchange trading API

2.0.0(2mo ago)2246523[1 issues](https://github.com/adman9000/laravel-binance/issues)[2 PRs](https://github.com/adman9000/laravel-binance/pulls)MITPHPPHP ^8.1

Since Aug 19Pushed 2mo ago4 watchersCompare

[ Source](https://github.com/adman9000/laravel-binance)[ Packagist](https://packagist.org/packages/adman9000/laravel-binance)[ RSS](/packages/adman9000-laravel-binance/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (2)Dependencies (4)Versions (4)Used By (0)

laravel-binance
===============

[](#laravel-binance)

Laravel implementation of the Binance Spot trading API.

[![Tests](https://github.com/adman9000/laravel-binance/actions/workflows/tests.yml/badge.svg)](https://github.com/adman9000/laravel-binance/actions)

Requirements
------------

[](#requirements)

- PHP 8.1+
- Laravel 10, 11, or 12

Install
-------

[](#install)

```
composer require adman9000/laravel-binance
```

Publish the config file:

```
php artisan vendor:publish --provider="adman9000\binance\BinanceServiceProvider"
```

Add your credentials to `.env`:

```
BINANCE_KEY=your-api-key
BINANCE_SECRET=your-api-secret

```

Usage
-----

[](#usage)

### Via facade

[](#via-facade)

```
use Binance;

$balances = Binance::getBalances();
$price    = Binance::getTickers('BTCUSDT');
```

### Via dependency injection

[](#via-dependency-injection)

```
use adman9000\binance\BinanceAPI;

class TradingService
{
    public function __construct(private BinanceAPI $binance) {}
}
```

### Direct instantiation

[](#direct-instantiation)

```
$binance = new BinanceAPI([
    'auth'     => ['key' => 'your-key', 'secret' => 'your-secret'],
    'urls'     => ['api' => 'https://api.binance.com/api/', 'sapi' => 'https://api.binance.com/sapi/'],
    'settings' => ['timing' => 5000, 'timeout' => 30, 'connect_timeout' => 10],
]);
```

Available Methods
-----------------

[](#available-methods)

### Public (no authentication required)

[](#public-no-authentication-required)

MethodDescription`getServerTime()`Server timestamp in milliseconds`getTickers(string $symbol = '')`All symbol prices, or a single price`getMarkets()`Exchange trading rules and symbol info`getOrderBook(string $symbol, int $limit = 100)`Bids and asks for a symbol`getPublicTrades(string $symbol, int $limit = 500)`Recent trades for a symbol`getAggTrades(string $symbol, int $limit = 500)`Compressed/aggregate trade list`getCandlesticks(string $symbol, string $interval = '1h', int $limit = 500)`Kline/candlestick data`getAvgPrice(string $symbol)`Current average price`getTickerChange(string $symbol = '')`24hr rolling window price change`getBookTicker(string $symbol = '')`Best price/qty on the order bookValid `$interval` values: `1s`, `1m`, `3m`, `5m`, `15m`, `30m`, `1h`, `2h`, `4h`, `6h`, `8h`, `12h`, `1d`, `3d`, `1w`, `1M`

### Private (API key + secret required)

[](#private-api-key--secret-required)

MethodDescription`getBalances()`All account balances`getBalance(string $asset)`Balance for a single asset (e.g. `'BTC'`), or `null` if not found`getRecentTrades(string $symbol, int $limit = 500)`Your trade history for a symbol`getOpenOrders(string $symbol = '')`Current open orders`getAllOrders(string $symbol)`All orders for a symbol`marketBuy(string $symbol, string $quantity)`Market buy order`marketSell(string $symbol, string $quantity)`Market sell order`limitBuy(string $symbol, string $quantity, float $price)`Limit buy order`limitSell(string $symbol, string $quantity, float $price)`Limit sell order`trade(string $symbol, string $quantity, string $side, string $type, ?float $price)`Raw order placement`depositAddress(string $coin)`Deposit address for an assetConfiguration
-------------

[](#configuration)

```
// config/binance.php
return [
    'auth' => [
        'key'    => env('BINANCE_KEY', ''),
        'secret' => env('BINANCE_SECRET', ''),
    ],
    'urls' => [
        'api'  => env('BINANCE_API_URL', 'https://api.binance.com/api/'),
        'sapi' => env('BINANCE_SAPI_URL', 'https://api.binance.com/sapi/'),
    ],
    'settings' => [
        'timing'          => env('BINANCE_TIMING', 5000),         // recvWindow in ms
        'timeout'         => env('BINANCE_TIMEOUT', 30),          // request timeout in seconds
        'connect_timeout' => env('BINANCE_CONNECT_TIMEOUT', 10),  // connection timeout in seconds
    ],
];
```

### Testnet

[](#testnet)

To use the Binance testnet, add to your `.env`:

```
BINANCE_API_URL=https://testnet.binance.vision/api/
BINANCE_SAPI_URL=https://testnet.binance.vision/sapi/

```

### Binance US

[](#binance-us)

```
BINANCE_API_URL=https://api.binance.us/api/
BINANCE_SAPI_URL=https://api.binance.us/sapi/

```

Error handling
--------------

[](#error-handling)

All API errors throw `adman9000\binance\Exceptions\BinanceApiException`:

```
use adman9000\binance\Exceptions\BinanceApiException;

try {
    $order = Binance::limitBuy('BTCUSDT', '0.001', 1.0);
} catch (BinanceApiException $e) {
    // $e->getMessage() — Binance error message
    // $e->getResponse() — full response array including error code
}
```

Upgrading from v1
-----------------

[](#upgrading-from-v1)

- `getTicker($symbol)` is deprecated — use `getTickers($symbol)` instead
- `getCurrencies()` has been removed (it returned `false`)
- `depositAddress($symbol)` now takes a coin ticker as `$coin` (same value, renamed parameter)
- `wapi` config URL removed — replaced by `sapi` (`https://api.binance.com/sapi/`)
- `ext-curl` is no longer required
- Errors now throw `BinanceApiException` instead of `\Exception`

Running tests
-------------

[](#running-tests)

```
composer install
./vendor/bin/phpunit
```

Licence
-------

[](#licence)

MIT

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance85

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 71.4% 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 ~2849 days

Total

2

Last Release

68d ago

Major Versions

1.0.0 → 2.0.02026-06-07

PHP version history (2 changes)1.0.0PHP &gt;=5.6.4

2.0.0PHP ^8.1

### Community

Maintainers

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

---

Top Contributors

[![adman9000](https://avatars.githubusercontent.com/u/4179099?v=4)](https://github.com/adman9000 "adman9000 (5 commits)")[![ikidnapmyself](https://avatars.githubusercontent.com/u/13779866?v=4)](https://github.com/ikidnapmyself "ikidnapmyself (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/adman9000-laravel-binance/health.svg)

```
[![Health](https://phpackages.com/badges/adman9000-laravel-binance/health.svg)](https://phpackages.com/packages/adman9000-laravel-binance)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

818355.4k3](/packages/defstudio-telegraph)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5226.7k](/packages/simplestats-io-laravel-client)[forjedio/inertia-table

Backend-driven dynamic tables for Laravel + Inertia.js

272.0k](/packages/forjedio-inertia-table)[jasara/php-amzn-selling-partner-api

A fluent interface for Amazon's Selling Partner API in PHP

1349.3k1](/packages/jasara-php-amzn-selling-partner-api)

PHPackages © 2026

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