PHPackages                             mrabdelaziz/binance-api - 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. mrabdelaziz/binance-api

ActiveLibrary[API Development](/categories/api)

mrabdelaziz/binance-api
=======================

A comprehensive Laravel package for Binance Spot API integration with account management

v1.0.0(1y ago)12MITPHPPHP ^8.1CI passing

Since May 22Pushed 1y ago1 watchersCompare

[ Source](https://github.com/MrAbdelaziz/binance-api)[ Packagist](https://packagist.org/packages/mrabdelaziz/binance-api)[ RSS](/packages/mrabdelaziz-binance-api/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (10)Versions (2)Used By (0)

Binance API Package for Laravel
===============================

[](#binance-api-package-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/4cf7c5e1dc5616d1a020d4339b3047974702626b3079e038e1749c5eeb4ed8db/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f4d72416264656c617a697a2f62696e616e63652d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/MrAbdelaziz/binance-api)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/f5813a1e99cfeab14664142b9e7e5483b6f97376733d2b5fa1a0bd9f1dfe92b0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f4d72416264656c617a697a2f62696e616e63652d6170692f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/MrAbdelaziz/binance-api/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/dfc4d290cf7a099c8c5cb4c468175c962964893d130ee58abd12c08700119ace/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f4d72416264656c617a697a2f62696e616e63652d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/MrAbdelaziz/binance-api)

A comprehensive Laravel package for Binance Spot API integration with full account management capabilities.

Features
--------

[](#features)

- **Account Management**: Get account information, balances, and trading status
- **Order Management**: Place, cancel, and query orders with full order lifecycle support
- **Position Tracking**: Real-time position monitoring and historical data
- **Market Data**: Real-time prices, 24h tickers, and market information
- **Security**: HMAC-SHA256 signature authentication for all account endpoints
- **Rate Limiting**: Built-in rate limiting and retry mechanisms
- **Error Handling**: Comprehensive error handling with detailed logging
- **Laravel Integration**: Service provider, facades, and configuration
- **Testable**: Full test suite with mocking capabilities

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require MrAbdelaziz/binance-api
```

You can publish the config file with:

```
php artisan vendor:publish --tag="binance-api-config"
```

Add your Binance API credentials to your `.env` file:

```
BINANCE_API_KEY=your_api_key_here
BINANCE_API_SECRET=your_api_secret_here
BINANCE_BASE_URL=https://api.binance.com
BINANCE_TESTNET=false
```

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

[](#quick-start)

### Account Information

[](#account-information)

```
use MrAbdelaziz\BinanceApi\Facades\BinanceApi;

// Get account information
$account = BinanceApi::account()->getAccountInfo();

// Get account balances
$balances = BinanceApi::account()->getAccountBalances();

// Get account trading status
$status = BinanceApi::account()->getAccountStatus();
```

### Order Management

[](#order-management)

```
// Place a market buy order
$order = BinanceApi::orders()->marketBuy('BTCUSDT', 0.001);

// Place a limit sell order
$order = BinanceApi::orders()->limitSell('BTCUSDT', 0.001, 50000);

// Cancel an order
$cancelled = BinanceApi::orders()->cancelOrder('BTCUSDT', $orderId);

// Get order status
$orderStatus = BinanceApi::orders()->getOrder('BTCUSDT', $orderId);

// Get all orders for a symbol
$orders = BinanceApi::orders()->getAllOrders('BTCUSDT');
```

### Market Data

[](#market-data)

```
// Get current price
$price = BinanceApi::market()->getPrice('BTCUSDT');

// Get 24hr ticker
$ticker = BinanceApi::market()->get24hrTicker('BTCUSDT');

// Get exchange info
$exchangeInfo = BinanceApi::market()->getExchangeInfo();
```

### Position Tracking

[](#position-tracking)

```
// Get open positions
$positions = BinanceApi::positions()->getOpenPositions();

// Get position for specific symbol
$position = BinanceApi::positions()->getPosition('BTCUSDT');

// Get position history
$history = BinanceApi::positions()->getPositionHistory('BTCUSDT');
```

Advanced Usage
--------------

[](#advanced-usage)

### Error Handling

[](#error-handling)

```
use MrAbdelaziz\BinanceApi\Exceptions\BinanceApiException;

try {
    $order = BinanceApi::orders()->marketBuy('BTCUSDT', 0.001);
} catch (BinanceApiException $e) {
    // Handle Binance API errors
    Log::error('Binance API Error: ' . $e->getMessage());
    Log::error('Error Code: ' . $e->getCode());
    Log::error('Error Data: ' . json_encode($e->getData()));
}
```

### Rate Limiting

[](#rate-limiting)

The package automatically handles rate limiting. You can configure the rate limits in the config file:

```
'rate_limits' => [
    'requests_per_minute' => 1200,
    'orders_per_second' => 10,
    'orders_per_day' => 200000,
],
```

### Custom Configuration

[](#custom-configuration)

```
// Using custom configuration
$customApi = new BinanceApi([
    'api_key' => 'custom_key',
    'api_secret' => 'custom_secret',
    'base_url' => 'https://testnet.binance.vision',
]);

$account = $customApi->account()->getAccountInfo();
```

Testing
-------

[](#testing)

```
composer test
```

Documentation
-------------

[](#documentation)

For detailed documentation visit the following files:

- [Installation Guide](INSTALLATION.md)

Security
--------

[](#security)

- All account endpoints use HMAC-SHA256 signature authentication
- API keys are never logged or exposed in error messages
- Timestamps are automatically synchronized with Binance servers
- All requests use HTTPS

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance46

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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

Unknown

Total

1

Last Release

408d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/60048840?v=4)[Abdelaziz](/maintainers/MrAbdelaziz)[@MrAbdelaziz](https://github.com/MrAbdelaziz)

---

Top Contributors

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

---

Tags

binancebinance-apilaravel-12-packageapilaravelportfoliocryptocurrencytradingbinancespot

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mrabdelaziz-binance-api/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/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.

5021.9k](/packages/simplestats-io-laravel-client)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

816333.8k3](/packages/defstudio-telegraph)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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