PHPackages                             ghanem/bee - 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. ghanem/bee

ActiveLibrary[API Development](/categories/api)

ghanem/bee
==========

A Laravel package that provides an interface to the Bee payment services API.

V2.1(2mo ago)0281MITPHPPHP ^8.1

Since Sep 27Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/AbdullahGhanem/bee)[ Packagist](https://packagist.org/packages/ghanem/bee)[ Docs](https://github.com/abdullahghanem/bee)[ RSS](/packages/ghanem-bee/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (6)Versions (4)Used By (0)

Bee
===

[](#bee)

[![Latest Stable Version](https://camo.githubusercontent.com/5cb222d95367920b9b83bf19cf597f0a8a479f6c2f111de2957580667542eaa4/68747470733a2f2f706f7365722e707567782e6f72672f6768616e656d2f6265652f762f737461626c652e737667)](https://packagist.org/packages/ghanem/bee) [![License](https://camo.githubusercontent.com/0d0254ed01768519455ad997ac7265efecbfd19a2d4430f0259dfdccd5c61041/68747470733a2f2f706f7365722e707567782e6f72672f6768616e656d2f6265652f6c6963656e73652e737667)](https://packagist.org/packages/ghanem/bee) [![Total Downloads](https://camo.githubusercontent.com/de18e7ff8c6b79beb8aef53310587e401f950be44c6aa4beaab7316fb91b1f14/68747470733a2f2f706f7365722e707567782e6f72672f6768616e656d2f6265652f646f776e6c6f6164732e737667)](https://packagist.org/packages/ghanem/bee)

A Laravel package that provides an interface to the Bee payment services API.

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

[](#requirements)

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

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

[](#installation)

```
composer require ghanem/bee
```

Publish the configuration file:

```
php artisan vendor:publish --provider="Ghanem\Bee\BeeServiceProvider" --tag="bee-config"
```

Configuration
-------------

[](#configuration)

Add the following to your `.env` file:

```
BEE_USERNAME=your-username
BEE_PASSWORD=your-password
BEE_URL=https://your-bee-api-url.com/
```

Usage
-----

[](#usage)

You can use the `Bee` facade or resolve `BeeService` from the container.

### Service &amp; Category Information

[](#service--category-information)

```
use Ghanem\Bee\Facades\Bee;

// Get all categories
$categories = Bee::getCategoryList();

// Get category service list
$categoryServices = Bee::getCategoryServiceList();

// Get provider list by category
$providers = Bee::getProviderList(categoryId: 2);

// Get all services
$services = Bee::getServiceList();

// Get service input/output parameters
$inputParams = Bee::getServiceInputParameterList();
$outputParams = Bee::getServiceOutputParameterList();
```

### Transactions

[](#transactions)

```
// Transaction inquiry
$inquiry = Bee::transactionInquiry([
    'account_number' => '12345',
    'service_id' => 10,
    'input_parameter_list' => [
        ['key' => 'phone', 'value' => '0912345678'],
    ],
]);

// Transaction payment
$payment = Bee::transactionPayment([
    'account_number' => '12345',
    'service_id' => 10,
    'external_id' => 'order-001',
    'amount' => 100,
    'service_charge' => 5,
    'total_amount' => 105,
    'quantity' => 1,
    'inquiry_transaction_id' => $inquiry['data']['transaction_id'],
    'input_parameter_list' => [],
]);

// Get transaction details by ID
$transaction = Bee::getTransaction(123);

// Get transaction by external ID
$transaction = Bee::getTransaction('order-001', 'external_id');
```

### Account &amp; Billing

[](#account--billing)

```
// Get account info
$account = Bee::getAccountInfo();

// Get bills amount (performs inquiry and returns amount)
$bills = Bee::getBillsAmount([
    'service_id' => 10,
    'account_number' => '12345',
]);
```

### Service Charge Calculation

[](#service-charge-calculation)

```
// Calculate service charge for an amount
$result = Bee::calculateServiceCharge([
    'service_id' => 10,
    'amount' => 100,
]);
// Returns: ['service_id' => 10, 'amount' => 100, 'service_charge' => 5, 'total_amount' => 105]

// Reverse calculate (from total amount back to base amount)
$result = Bee::calculateServiceChargeReverse([
    'service_id' => 10,
    'amount' => 105, // total amount including charge
]);
// Returns: ['service_id' => 10, 'amount' => 95.45, 'service_charge' => 9.55, 'total_amount' => 105]
```

### Language Support

[](#language-support)

Most methods accept a language parameter (defaults to `'en'`):

```
$categories = Bee::getCategoryList('ar');
$services = Bee::getServiceList('ar');
```

### DTOs (Typed Responses)

[](#dtos-typed-responses)

Use `*Dto` methods for typed response objects instead of raw arrays/collections:

```
use Ghanem\Bee\DTOs\ApiResponse;
use Ghanem\Bee\DTOs\TransactionResult;
use Ghanem\Bee\DTOs\ServiceChargeResult;

// API response DTO
$response = Bee::getCategoryListDto(); // returns ApiResponse
$response->success;    // bool
$response->data;       // array
$response->statusCode; // int
$response->get('categories.0.name'); // dot notation access

// Transaction DTO
$tx = Bee::getTransactionDto(123); // returns TransactionResult
$tx->transactionId; // ?int
$tx->amount;        // ?float
$tx->serviceCharge; // ?float
$tx->totalAmount;   // ?float

$inquiry = Bee::transactionInquiryDto($data);  // TransactionResult
$payment = Bee::transactionPaymentDto($data);  // TransactionResult

// Service charge DTO
$charge = Bee::calculateServiceChargeDto([
    'service_id' => 10,
    'amount' => 100,
]); // returns ServiceChargeResult
$charge->serviceId;     // int
$charge->amount;        // float
$charge->serviceCharge; // float
$charge->totalAmount;   // float
```

### Retry Mechanism

[](#retry-mechanism)

Failed API requests are automatically retried with exponential backoff:

```
BEE_RETRY_TRIES=3       # Number of retry attempts
BEE_RETRY_DELAY=100     # Initial delay in milliseconds
BEE_RETRY_MULTIPLIER=2  # Backoff multiplier
```

### Request/Response Logging

[](#requestresponse-logging)

Enable logging to debug API calls. Credentials are automatically redacted:

```
BEE_LOG_ENABLED=true
BEE_LOG_CHANNEL=stack   # Optional: specific log channel
```

### Caching

[](#caching)

Service and category lists are automatically cached to reduce API calls:

```
BEE_CACHE_ENABLED=true    # Enabled by default
BEE_CACHE_TTL=3600        # Cache lifetime in seconds
BEE_CACHE_STORE=redis     # Optional: specific cache store
```

```
// Clear all cached data
Bee::clearCache();

// Clear specific cache key
Bee::clearCache('category_list_en');
```

### Rate Limiting

[](#rate-limiting)

Limit the number of API requests per minute:

```
BEE_RATE_LIMIT_ENABLED=true
BEE_RATE_LIMIT_MAX=60      # Max requests per minute
```

### Webhooks

[](#webhooks)

Receive transaction status updates via webhooks:

```
BEE_WEBHOOK_ENABLED=true
BEE_WEBHOOK_PATH=bee/webhook
BEE_WEBHOOK_SECRET=your-secret  # Optional: signature validation
```

Listen for webhook events in your application:

```
use Ghanem\Bee\Events\BeeWebhookReceived;
use Ghanem\Bee\Events\TransactionStatusUpdated;

// Listen to all webhook events
Event::listen(BeeWebhookReceived::class, function ($event) {
    // $event->event   - event name (e.g. 'transaction.completed')
    // $event->payload - full webhook payload
});

// Listen specifically to transaction status changes
Event::listen(TransactionStatusUpdated::class, function ($event) {
    // $event->transactionId
    // $event->status
    // $event->payload
});
```

### Async / Queue Support

[](#async--queue-support)

Process transactions asynchronously using Laravel queues:

```
BEE_QUEUE_CONNECTION=redis   # Optional: queue connection
BEE_QUEUE_NAME=payments      # Optional: queue name
```

```
// Dispatch a single payment to the queue
Bee::transactionPaymentAsync([
    'account_number' => '12345',
    'service_id' => 10,
    'amount' => 100,
]);

// Batch multiple transactions
$batch = Bee::batchTransactions([
    ['action' => 'payment', 'data' => ['service_id' => 10, 'amount' => 100]],
    ['action' => 'inquiry', 'data' => ['service_id' => 11, 'account_number' => '123']],
    ['action' => 'payment', 'data' => ['service_id' => 12, 'amount' => 200], 'lang' => 'ar'],
]);

// Batch with callback event
Bee::batchTransactions($transactions, App\Events\TransactionProcessed::class);
```

Changelog
---------

[](#changelog)

### Done

[](#done)

- Bee API integration (services, categories, providers)
- Transaction inquiry and payment
- Service charge calculation (forward and reverse)
- Bills amount retrieval
- Account info
- Transaction lookup by ID and external ID
- Multi-language support (en, ar, etc.)
- Facade with full IDE autocompletion
- Laravel 10, 11, and 12 support
- PHP 8.1+ with modern type hints
- Full test coverage (96 tests)
- Retry mechanism for failed API requests
- Request/response logging
- Caching for service and category lists
- Webhook support for transaction status updates
- DTOs for API responses (ApiResponse, TransactionResult, ServiceChargeResult)
- Rate limiting support
- Async/queue support for batch transactions

Testing
-------

[](#testing)

```
composer test
```

Sponsor
-------

[](#sponsor)

[Become a Sponsor](https://github.com/sponsors/AbdullahGhanem)

License
-------

[](#license)

MIT

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance87

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity57

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

Every ~629 days

Total

3

Last Release

62d ago

Major Versions

v1.0 → V2.02026-03-08

PHP version history (2 changes)v1.0PHP ^7.3|^8.0

V2.0PHP ^8.1

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

phpapilaravelpaymentbee

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ghanem-bee/health.svg)

```
[![Health](https://phpackages.com/badges/ghanem-bee/health.svg)](https://phpackages.com/packages/ghanem-bee)
```

###  Alternatives

[resend/resend-laravel

Resend for Laravel

1191.4M6](/packages/resend-resend-laravel)[mollie/laravel-mollie

Mollie API client wrapper for Laravel &amp; Mollie Connect provider for Laravel Socialite

3624.1M28](/packages/mollie-laravel-mollie)[wayofdev/laravel-symfony-serializer

📦 Laravel wrapper around Symfony Serializer.

2113.6k](/packages/wayofdev-laravel-symfony-serializer)

PHPackages © 2026

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