Download the PHP package pralhadstha/nepal-can-php-sdk without Composer
On this page you can find all versions of the php package pralhadstha/nepal-can-php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pralhadstha/nepal-can-php-sdk
More information about pralhadstha/nepal-can-php-sdk
Files in pralhadstha/nepal-can-php-sdk
Package nepal-can-php-sdk
Short Description PHP SDK for Nepal Can Move (NCM) shipping and courier API - order creation, tracking, webhooks, COD, and delivery management for Nepal
License MIT
Homepage https://github.com/pralhadstha/nepal-can-php-sdk
Informations about the package nepal-can-php-sdk
Nepal Can Move (NCM) PHP SDK
A PHP SDK for integrating with the Nepal Can Move (NCM) shipping and courier API. Manage shipments, track orders, calculate delivery rates, handle COD (Cash on Delivery) payments, and receive real-time webhook notifications for your e-commerce platform in Nepal.
Table of Contents
- Features
- Requirements
- Installation
- Configuration
- Usage
- Branches
- Shipping Rates
- Create Order
- Get Order Details
- Order Comments
- Tracking
- Returns & Exchanges
- Tickets
- Staff
- Webhooks
- Event Dispatcher
- Laravel
- Idempotency
- Error Handling
- API Limits
- Testing
- Code Style
- Changelog
- Contributing
- Credits
- License
Features
- Shipment Management - Create, find, return, exchange, and redirect orders
- Order Tracking - Status history and bulk status checks
- Rate Calculation - Delivery charges for 4 delivery types (Door2Door, Branch2Door, Door2Branch, Branch2Branch)
- Branch Listing - Get all NCM branches with contact details and covered areas
- COD Support - Cash on delivery charge management and COD transfer tickets
- Webhook Integration - Parse incoming webhooks with typed resources and event dispatcher
- Support Tickets - Create and manage vendor support tickets
- Staff Management - List and search vendor staff members
- Type-Safe - Immutable resource objects with readonly properties
- Well Tested - Comprehensive test suite with mocked HTTP responses
- PSR-12 Compliant - Enforced via PHP-CS-Fixer
Requirements
- PHP 8.1+
- Guzzle 7.0+
Installation
Configuration
Note: Request your API token from NCM's IT Admin. Sandbox and production environments use separate tokens.
Usage
Branches
Shipping Rates
Available delivery types:
RateService::TYPE_PICKUP_COLLECT- Door2Door (NCM pickup & delivery)RateService::TYPE_SEND- Branch2Door (Sender drops at branch, NCM delivers)RateService::TYPE_D2B- Door2Branch (NCM picks, customer collects at branch)RateService::TYPE_B2B- Branch2Branch (Sender drops at branch, customer collects)
Create Order
Get Order Details
Order Comments
Tracking
Returns & Exchanges
Tickets
Available ticket types: General, Order Processing, Return, Pickup
Staff
Webhooks
NCM sends HTTP POST requests to your configured webhook URL when order status changes occur. This SDK provides typed parsing via $client->webhooks->parse(), User-Agent validation via $client->webhooks->isValidUserAgent(), and an event dispatcher for clean webhook handling.
Event Dispatcher
Use the EventDispatcher to route webhook events to handler classes instead of if/else chains:
Laravel
For Laravel applications, use the official Laravel wrapper which provides service provider, facade, config publishing, and artisan commands out of the box:
pralhadstha/nepalcan-laravel - Official Laravel wrapper for Nepal Can Move SDK
If you prefer using the SDK directly without the Laravel wrapper, you can still use this package in any PHP application including Laravel.
Supported webhook events:
WebhookEvent::PICKUP_COMPLETED- Order picked upWebhookEvent::SENT_FOR_DELIVERY- Order sent for deliveryWebhookEvent::ORDER_DISPATCHED- Order dispatched from origin branchWebhookEvent::ORDER_ARRIVED- Order arrived at destination branchWebhookEvent::DELIVERY_COMPLETED- Order delivered
Idempotency
NCM may send duplicate webhook notifications. Your application should handle this by tracking processed webhooks to avoid processing the same event twice:
Error Handling
API Limits
- Order Creation: 1,000 per day
- Order View (Detail, Comments, Status): 20,000 per day
Testing
Run the test suite:
Code Style
This project follows PSR-12 coding standards enforced via PHP-CS-Fixer.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Credits
- Pralhad Kumar Shrestha
- Nepal Can Move (NCM) - Shipping & Courier API Provider
License
The MIT License (MIT). Please see LICENSE file for more information.