PHPackages                             laravel-nepal/nepal-can-move - 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. laravel-nepal/nepal-can-move

ActiveLibrary[API Development](/categories/api)

laravel-nepal/nepal-can-move
============================

SDK for integration with the Nepal Can Move API in PHP applications.

v1.2.1(2mo ago)1238MITPHPPHP ^8.2|^8.3|^8.4

Since Jan 27Pushed 2mo agoCompare

[ Source](https://github.com/Laravel-Nepal/nepal-can-move-php)[ Packagist](https://packagist.org/packages/laravel-nepal/nepal-can-move)[ Fund](https://www.buymeacoffee.com/achyutn)[ Fund](https://buymemomo.com/achyut)[ RSS](/packages/laravel-nepal-nepal-can-move/feed)WikiDiscussions master Synced 1mo ago

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

Nepal Can Move PHP SDK
======================

[](#nepal-can-move-php-sdk)

[![Lint & Test PR](https://github.com/Laravel-Nepal/nepal-can-move-php/actions/workflows/prlint.yml/badge.svg)](https://github.com/achyutkneupane/nepal-can-move-php/actions/workflows/prlint.yml)

A strictly typed, and expressive PHP SDK for integrating with the **Nepal Can Move (NCM)** logistics API.

This package provides a fluent wrapper around the NCM API, normalizing API responses into clean Data Transfer Objects (DTOs), leveraging PHP 8.1+ Enums for type safety, and handling all authentication and error states automatically.

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

[](#requirements)

- PHP: **8.2+**
- Laravel: **10.x**, **11.x**, or **12.x**

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

[](#installation)

Install the package via Composer:

```
composer require laravel-nepal/nepal-can-move
```

*(Optional)* Publish the configuration file:

```
php artisan vendor:publish --tag="nepal-can-move"
```

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

[](#configuration)

Add your NCM credentials to your `.env` file. Enable sandbox mode for testing.

```
NCM_TOKEN=your_api_token_here
NCM_SANDBOX_MODE=true
```

> You can get your token by registering a vendor account then from the portal dashboard.

Usage
-----

[](#usage)

Warning

### API Limits

[](#api-limits)

Please be mindful of the NCM API limits to avoid IP throttling:

Order Creation: **1,000 per day**.
Order Views (Detail/Status): **20,000 per day**.

### Fetching Branches

[](#fetching-branches)

Retrieve all available NCM branches as strictly typed `Branch` objects.

```
use LaravelNepal\NCM\Facades\NCM;

$branches = NCM::getBranches();

$tinkune = $branches->firstWhere('name', 'TINKUNE');

echo $tinkune->phone;
```

### Calculating Shipping Rates

[](#calculating-shipping-rates)

Calculate delivery charges using the `DeliveryType` enum.

```
use LaravelNepal\NCM\Enums\DeliveryType;

$charge = NCM::getDeliveryCharge(
    source: $tinkune,
    destination: $pokhara,
    deliveryType: DeliveryType::BranchToDoor
);
```

### Creating an Order

[](#creating-an-order)

Use the `CreateOrderRequest` DTO to ensure all required fields are present.

```
use LaravelNepal\NCM\Data\CreateOrderRequest;
use LaravelNepal\NCM\Enums\DeliveryType;

$request = new CreateOrderRequest(
    name: 'Achyut Neupane',
    phone: '9800000000',
    codCharge: '1500',
    address: 'Lakeside, Pokhara',
    sourceBranch: 'KATHMANDU',
    destinationBranch: 'POKHARA',
    package: 'Books',
    deliveryType: DeliveryType::DoorToDoor
);

$order = NCM::createOrder($request);

echo $order->id;
```

Important

The NCM API uses different naming conventions across its endpoints (e.g., Pickup/Collect vs Door2Door).
This SDK normalizes these into the DeliveryType enum. You should always use the Enum cases; the SDK handles the underlying API string transformations automatically.

### Order Management

[](#order-management)

The `Order` object exposes rich behavior.

#### Fetching an Order

[](#fetching-an-order)

```
$order = NCM::getOrder(12345);
```

#### Status History

[](#status-history)

```
$history = $order->statusHistory();

foreach ($history as $status) {
    echo $status->status . ' - ' . $status->addedTime->diffForHumans();
}
```

##### Latest Order Status

[](#latest-order-status)

```
echo $order->status();
```

#### Comments

[](#comments)

```
$order->addComment('Customer requested evening delivery.');

$comments = $order->comments();
```

#### Return &amp; Exchange

[](#return--exchange)

```
$order->return('Customer refused delivery');

$order->exchange();
```

### Redirecting an Order

[](#redirecting-an-order)

```
use LaravelNepal\NCM\Data\RedirectOrderRequest;

$redirect = new RedirectOrderRequest(
    orderId: $order->id,
    name: 'Not Achyut Neupane',
    phone: '9811111111',
    address: 'New Address, Kathmandu',
    orderIdentifier: 'ORD-REF-002',
    destinationBranchId: 5,
    codCharge: 1600.00
);

NCM::redirectOrder($redirect);
```

### Support Tickets

[](#support-tickets)

#### General Support

[](#general-support)

```
use LaravelNepal\NCM\Enums\TicketType;

NCM::createSupportTicket(
    TicketType::OrderProcessing,
    "My order is stuck in Pickup status for 3 days."
);
```

#### COD Transfer Request

[](#cod-transfer-request)

```
$ticketId = NCM::createCODTransferTicket(
    bankName: 'Nabil Bank',
    accountHolderName: 'My Company Pvt Ltd',
    accountNumber: '001001001001'
);
```

Webhooks
--------

[](#webhooks)

The Nepal Can Move SDK allows you to manage your webhook configuration and transform incoming `POST` data into strictly typed objects.

### Configuring Webhooks

[](#configuring-webhooks)

You can programmatically set, test, or remove your webhook URL:

```
// Set the URL where NCM will push updates
$ncm->setWebhookUrl('https://your-app.com/api/ncm/webhook');

// Send a test payload to your URL to verify connectivity
$ncm->testWebhookUrl('https://your-app.com/api/ncm/webhook');

// Disable webhooks
$ncm->removeWebhookUrl();
```

### Handling Webhook Payloads

[](#handling-webhook-payloads)

When NCM sends a status update to your server, use `parseWebhook` to convert the raw request data into a [StatusEvent](src/Data/StatusEvent.php) DTO. This automatically maps technical events to your `OrderStatus` enums using the [`toOrderStatus`](src/Enums/EventStatus.php#L37) method.

```
use LaravelNepal\NCM\Exceptions\NCMException;
use LaravelNepal\NCM\Enums\OrderStatus;

try {
    $event = $ncm->parseWebhook($payload);

    echo $event->orderIds; // e.g., [123, 124]
    echo $event->event->getLabel(); // e.g., "Delivered"

    // Get the normalized OrderStatus enum
    $status = $event->getOrderStatus();

    if ($status === OrderStatus::Delivered) {
        // Perform business logic
    }
} catch (NCMException $NCMException) {
    // Handle unknown event types or malformed data
}
```

Tip

Since NCM webhooks do not currently include a cryptographic signature, it is recommended to add a unique query parameter to your webhook URL (e.g., `?secret=your-random-key`) and verify it in your controller to ensure the request is legitimate.

Exception Handling
------------------

[](#exception-handling)

```
use LaravelNepal\NCM\Exceptions\NCMException;

try {
    NCM::createOrder($request);
} catch (NCMException $e) {
    return back()->withErrors($e->getMessage());
}
```

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

[](#contributing)

Contributions are welcome! Please create a pull request or open an issue if you find any bugs or have feature requests.

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE.md).

Support
-------

[](#support)

If you find this package useful, please consider starring the repository on GitHub to show your support.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance83

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity55

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 ~7 days

Total

4

Last Release

89d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/52259760?v=4)[achyutn](/maintainers/achyutn)[@AchyutN](https://github.com/AchyutN)

---

Top Contributors

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

---

Tags

phplaravelsdke-commercenepalnepal can move

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/laravel-nepal-nepal-can-move/health.svg)

```
[![Health](https://phpackages.com/badges/laravel-nepal-nepal-can-move/health.svg)](https://phpackages.com/packages/laravel-nepal-nepal-can-move)
```

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[resend/resend-laravel

Resend for Laravel

1191.4M6](/packages/resend-resend-laravel)[mozex/anthropic-laravel

Anthropic PHP for Laravel is a supercharged PHP API client that allows you to interact with the Anthropic API

71226.4k1](/packages/mozex-anthropic-laravel)[simplestats-io/laravel-client

Client for SimpleStats!

4515.5k](/packages/simplestats-io-laravel-client)[dariusiii/tmdb-laravel

Laravel Package for TMDB ( The Movie Database ) API. Provides easy access to the wtfzdotnet/php-tmdb-api library.

1821.1k](/packages/dariusiii-tmdb-laravel)

PHPackages © 2026

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