PHPackages                             t-a-zihad/steadfast-courier-laravel-package - 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. t-a-zihad/steadfast-courier-laravel-package

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

t-a-zihad/steadfast-courier-laravel-package
===========================================

A complate Laravel package for SteadFast Courier Limited

01PHP

Since Aug 2Pushed 9mo agoCompare

[ Source](https://github.com/t-a-zihad/SteadFast-Courier-Laravel-Package)[ Packagist](https://packagist.org/packages/t-a-zihad/steadfast-courier-laravel-package)[ RSS](/packages/t-a-zihad-steadfast-courier-laravel-package/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

 [![](https://raw.githubusercontent.com/steadfast-it/SteadFast-Courier-Laravel-Package/main/logo.png)](https://raw.githubusercontent.com/steadfast-it/SteadFast-Courier-Laravel-Package/main/logo.png)

A complate Laravel package for SteadFast Courier Limited
========================================================

[](#a-complate-laravel-package-for-steadfast-courier-limited)

[![](https://camo.githubusercontent.com/1b09df72d8b89f6ed484710f89279bc28bc6c20ce967ad9be9d2116c3ace467d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7374656164666173742d69742f5374656164466173742d436f75726965722d4c61726176656c2d5061636b6167652e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/1b09df72d8b89f6ed484710f89279bc28bc6c20ce967ad9be9d2116c3ace467d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7374656164666173742d69742f5374656164466173742d436f75726965722d4c61726176656c2d5061636b6167652e7376673f7374796c653d666c61742d737175617265)[![](https://camo.githubusercontent.com/5febff88880f33dcd3c590c64edc3b2b3f23f1a2b880bbf7b8ebcf16fb0fe1a9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7374656164666173742d69742f5374656164466173742d436f75726965722d4c61726176656c2d5061636b6167652e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/5febff88880f33dcd3c590c64edc3b2b3f23f1a2b880bbf7b8ebcf16fb0fe1a9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7374656164666173742d69742f5374656164466173742d436f75726965722d4c61726176656c2d5061636b6167652e7376673f7374796c653d666c61742d737175617265)

This is a Laravel/PHP package for [Steadfast](https://www.steadfast.com.bd/) Courier System. This package can be used in laravel projects. You can use this package for headless/rest implementation as well as blade or regular mode development. We created this package while working for a project and thought to made it release for all so that it helps. This package is available as regular php [composer package](https://packagist.org/packages/steadfast-it/SteadFast-Courier-Laravel-Package).

Features
--------

[](#features)

1. [Placing an order](https://github.com/steadfast-it/SteadFast-Courier-Laravel-Package#2-placing-an-order)
2. [Bulk Order Create](https://github.com/steadfast-it/SteadFast-Courier-Laravel-Package#3-bulk-order-create)
3. [Checking Delivery Status](https://github.com/steadfast-it/SteadFast-Courier-Laravel-Package#4-checking-deliverystatus)
4. [Checking Current Balance](https://github.com/steadfast-it/SteadFast-Courier-Laravel-Package#5-checking-current-balance)

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

[](#installation)

You can install the package via composer:

```
composer require steadfast-courier/steadfast-courier-laravel-package
```

You can publish the config file with:

```
php artisan vendor:publish --tag="steadfast-courier-config"
```

After publish config file setup your credential. you can see this in your config directory steadfast-courier.php file

```
 "base_url" => env('STEADFAST_BASE_URL', 'https://portal.steadfast.com.bd/api/v1'),
 "api_key" => env('STEADFAST_API_KEY', 'your-api-key'),
 "secret_key" => env('STEADFAST_SECRET_KEY', 'your-secret-key'),
 "webhook_bearer_token" => env('STEADFAST_BEARER_TOKEN', 'your-generated-token'),
```

### Set .env configuration

[](#set-env-configuration)

```
STEADFAST_BASE_URL= "https://portal.steadfast.com.bd/api/v1"
STEADFAST_API_KEY = "your-api-key"
STEADFAST_SECRET_KEY ="your-secret-key"
```

### 1. Placing an order

[](#1-placing-an-order)

`use SteadFast\SteadFastCourierLaravelPackage\Facades\SteadfastCourier;` Use this namespace at the top of the php class file

```
$orderData = [
    'invoice' => '123456',
    'recipient_name' => 'John Doe',
    'recipient_phone' => '01234567890',
    'recipient_address' => 'Fla# A1,House# 17/1, Road# 3/A, Dhanmondi,Dhaka-1209',
    'cod_amount' => 1000,
    'note' => 'Handle with care'
];

$response = SteadfastCourier::placeOrder($orderData);
```

#### Response:

[](#response)

```
{
    "status": 200,
    "message": "Consignment has been created successfully.",
    "consignment": {
        "consignment_id": 1424107,
        "invoice": "Aa12-das4",
        "tracking_code": "15BAEB8A",
        "recipient_name": "John Doe",
        "recipient_phone": "01234567890",
        "recipient_address": "Fla# A1,House# 17/1, Road# 3/A, Dhanmondi,Dhaka-1209",
        "cod_amount": 1000,
        "status": "in_review",
        "note": "Deliver within 3PM",
        "created_at": "2021-03-21T07:05:31.000000Z",
        "updated_at": "2021-03-21T07:05:31.000000Z"
    }
}
```

### 2. Bulk Order Create

[](#2-bulk-order-create)

`use  SteadFast\SteadFastCourierLaravelPackage\Facades\SteadfastCourier;` Use this is at the top of the php class file

```
$ordersData =
[
    [
        'invoice' => '123456',
        'recipient_name' => 'John Doe',
        'recipient_phone' => '01234567890',
        'recipient_address' => '123 Main St',
        'cod_amount' => 1000,
        'note' => 'Handle with care'
    ],[
        'invoice' => '789012',
        'recipient_name' => 'Jane Smith',
        'recipient_phone' => '09876543210',
        'recipient_address' => '456 Elm St',
        'cod_amount' => 1500,
        'note' => 'Fragile'
    ]
];

$response = SteadfastCourier::bulkCreateOrders($ordersData);
```

#### Response:

[](#response-1)

```
[
    {
        "invoice": "230822-1",
        "recipient_name": "John Doe",
        "recipient_address": "House 44, Road 2/A, Dhanmondi, Dhaka 1209",
        "recipient_phone": "0171111111",
        "cod_amount": "0.00",
        "note": null,
        "consignment_id": 11543968,
        "tracking_code": "B025A038",
        "status": "success"
    },
    {
        "invoice": "230822-1",
        "recipient_name": "John Doe",
        "recipient_address": "House 44, Road 2/A, Dhanmondi, Dhaka 1209",
        "recipient_phone": "0171111111",
        "cod_amount": "0.00",
        "note": null,
        "consignment_id": 11543969,
        "tracking_code": "B025A1DC",
        "status": "success"
    }
]
```

If there is any error in your data or network, the response will be like this.
------------------------------------------------------------------------------

[](#if-there-is-any-error-in-your-data-or-network-the-response-will-be-like-this)

#### Response:

[](#response-2)

```
[
    {
        "invoice": "230822-1",
        "recipient_name": "John Doe",
        "recipient_address": "House 44, Road 2/A, Dhanmondi, Dhaka 1209",
        "recipient_phone": "0171111111",
        "cod_amount": "0.00",
        "note": null,
        "consignment_id": null,
        "tracking_code": null,
        "status": "error"
    },
]
```

### 3. Checking Delivery Status

[](#3-checking-delivery-status)

There are three way to check Delivery Status, and each have same response like below.

`use  SteadFast\SteadFastCourierLaravelPackage\Facades\SteadfastCourier;` Use this at the top of the php class file

```
// Way 1: Check Delivery Status using Consignment ID
$consignmentId = 123456;
$response1 = SteadfastCourier::checkDeliveryStatusByConsignmentId($consignmentId);

// Way 2: Check Delivery Status using Invoice ID
$invoice = "230822-1";
$response3 = SteadfastCourier::checkDeliveryStatusByInvoiceId($invoice);

// Way 3: Check Delivery Status using Tracking Code
$trackingCode = "B025A3FA";
$response2 = SteadfastCourier::checkDeliveryStatusByTrackingCode($trackingCode);
```

Response:

```
{
    "status": 200,
    "delivery_status": "in_review"
}
```

Delivery Statuses
-----------------

[](#delivery-statuses)

Here are the possible delivery statuses returned by the Steadfast Courier API along with their descriptions:

- **pending**: Consignment is not delivered or cancelled yet.
- **delivered\_approval\_pending**: Consignment is delivered but waiting for admin approval.
- **partial\_delivered\_approval\_pending**: Consignment is delivered partially and waiting for admin approval.
- **cancelled\_approval\_pending**: Consignment is cancelled and waiting for admin approval.
- **unknown\_approval\_pending**: Unknown Pending status. Need contact with the support team.
- **delivered**: Consignment is delivered and balance added.
- **partial\_delivered**: Consignment is partially delivered and balance added.
- **cancelled**: Consignment is cancelled and balance updated.
- **hold**: Consignment is held.
- **in\_review**: Order is placed and waiting to be reviewed.
- **unknown**: Unknown status. Need contact with the support team.

```
[
    pending,
    delivered_approval_pending,
    partial_delivered_approval_pending,
    cancelled_approval_pending,
    unknown_approval_pending,
    delivered,
    partial_delivered,
    cancelled,
    hold,
    in_review,
    unknown
]
```

You can use these statuses to track the progress of your consignments and take appropriate actions.

### 4. Checking Current Balance

[](#4-checking-current-balance)

`use  SteadFast\SteadFastCourierLaravelPackage\Facades\SteadfastCourier;` Use this at the top of the php class file

```
$response = SteadfastCourier::getCurrentBalance();
```

#### Response:

[](#response-3)

```
{
    "status": 200,
    "current_balance": 0
}
```

### 5. Webhook Integration

[](#5-webhook-integration)

SteadFast Webhook wants `Callback Url` and `Auth Token(Bearer)`

**Callback Url:** **SteadFast** will use this URL to announce any changes to the parcel status. **Auth Token(Bearer):** For Authentication.

#### Make a Api Route

[](#make-a-api-route)

```
Route::post('/staedfast-webhook', [SteadFastWebhookController::class, 'handleSteadFastWebhook']);
```

#### Set Auth Token(Bearer) in .env

[](#set-auth-tokenbearer-in-env)

```
STEADFAST_BEARER_TOKEN ="your-generated-bearer-token"
```

#### Controller: `SteadFastWebhookController` or your Own made Controller

[](#controller-steadfastwebhookcontroller-or-your-own-made-controller)

```
public function handleSteadFastWebhook(Request $request)
{
    $payload = $request->all();
    $token = $request->header('Authorization');

    // Check if Bearer token is valid
    if ($token !== 'Bearer '. config('steadfast-courier.webhook_bearer_token')) {
        return response()->json(['error' => 'Unauthorized'], 401);
    }

    try {
        $this->validatePayload($payload);
        $this->processPayload($payload);

        return response()->json(['status' => 'success'], 200);
    } catch (\Throwable $th) {
        return response()->json(['error' => $th->getMessage()], 400);
    }

    return response()->json(['message' => 'Webhook received'], 200);
}

private function validatePayload($payload)
{
    $properties = [
        'consignment_id',
        'invoice',
        'status',
        'cod_amount',
        'updated_at',
    ];
    $missingProperties = array_diff($properties, array_keys($payload));
    if ($missingProperties) {
        abort(400, 'Missing required properties: ' . implode(', ', $missingProperties));
    }
}

private function processPayload($payload)
{
    $consignment_id = $payload['consignment_id'];
    $orderStatus = $payload['status'];

    /**
    *| WRITE YOUR CODE
    *| FOR HANDLE THE COURIER STATUS
    *| OF YOUR APPLICATION
    */
}
```

Support For any issues or questions related to this package, please open an issue on GitHub.

Credits
-------

[](#credits)

- [AmadulHaque](https://github.com/AmadulHaque)

License
-------

[](#license)

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

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance41

Moderate activity, may be stable

Popularity1

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity14

Early-stage or recently created project

 Bus Factor1

Top contributor holds 56.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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/9a15a217f9da876abc4aee60d6404b77370a1e4eb862f8d90df6e1dfec22cfef?d=identicon)[t-a-zihad](/maintainers/t-a-zihad)

---

Top Contributors

[![AmadulHaque](https://avatars.githubusercontent.com/u/92516695?v=4)](https://github.com/AmadulHaque "AmadulHaque (13 commits)")[![steadfast-it](https://avatars.githubusercontent.com/u/162102032?v=4)](https://github.com/steadfast-it "steadfast-it (6 commits)")[![rajibbinalam](https://avatars.githubusercontent.com/u/41984925?v=4)](https://github.com/rajibbinalam "rajibbinalam (2 commits)")[![t-a-zihad](https://avatars.githubusercontent.com/u/61927505?v=4)](https://github.com/t-a-zihad "t-a-zihad (1 commits)")[![UtsabDey](https://avatars.githubusercontent.com/u/44144515?v=4)](https://github.com/UtsabDey "UtsabDey (1 commits)")

### Embed Badge

![Health badge](/badges/t-a-zihad-steadfast-courier-laravel-package/health.svg)

```
[![Health](https://phpackages.com/badges/t-a-zihad-steadfast-courier-laravel-package/health.svg)](https://phpackages.com/packages/t-a-zihad-steadfast-courier-laravel-package)
```

###  Alternatives

[symplify/vendor-patches

Generate vendor patches for packages with single command

1876.7M27](/packages/symplify-vendor-patches)[muffin/orderly

Default ordering (behavior) for CakePHP

22217.3k1](/packages/muffin-orderly)[bymayo/commerce-widgets

Insightful dashboard widgets for your Craft Commerce store.

3311.6k](/packages/bymayo-commerce-widgets)[liberu-genealogy/php-dna

DNA analysis toolkit for PHP 8.3+

334.3k1](/packages/liberu-genealogy-php-dna)[sciactive/hookphp

Method hooking in PHP.

333.0k3](/packages/sciactive-hookphp)

PHPackages © 2026

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