seshac/laravel-shiprocket-api
最新稳定版本:2.0.0
Composer 安装命令:
composer require seshac/laravel-shiprocket-api
包简介
Shiprocket API (V1) Laravel SDK. Integration of Shiprocket API in your laravel application is easy, This package enables you to utilize most of your Shiprocket functions.
README 文档
README
Laravel SDK (module) for Shiprocket API Version 1. The integration of Shiprocket API in your laravel application is made easy.
Index
Installation
You can install the package via composer:
composer require seshac/laravel-shiprocket-api
You can publish config file with:
php artisan vendor:publish --provider="Seshac\Shiprocket\ShiprocketServiceProvider" --tag="config"
This is the contents of the published config file:
return [ /* |-------------------------------------------------------------------------- | Default Shiprocket Credentilas |-------------------------------------------------------------------------- | | Here you can set the default shiprocket credentilas. However, you can pass the credentials while connecting to shiprocket client | */ 'credentials' => [ 'email' => env('SHIPROCKET_EMAIL', 'example@email.com'), 'password' => env('SHIPROCKET_PASSWORD', 'password'), ], /* |-------------------------------------------------------------------------- | Default output response type |-------------------------------------------------------------------------- | | Here you may specify which of the output response you need. | | Supported: "collection" , "object", "array" | */ 'responseType' => 'collection', ];
Authentication
https://apidocs.shiprocket.in/?version=latest#8a56b4d6-b418-43cf-be25-ead62532aa18
Get the login details
use Seshac\Shiprocket\Shiprocket; . . . $loginDetails = Shiprocket::login([ 'email' => 'yourAPiMail@example.com', 'password' => 'example' ]) // if you added credentials at shiprocket.php config file no need to pass credentials
Or
Get the Token directly
use Seshac\Shiprocket\Shiprocket; . . . $token = Shiprocket::getToken();// if you added credentials at shiprocket.php config
Orders
get all Orders
https://apidocs.shiprocket.in/?version=latest#d4f48023-b0b2-40af-8072-1adf97227d21
$token = Shiprocket::getToken(); $orderDetails = [ // refer above url for required parameters 'per_page'=>20, ]; $response = Shiprocket::order($token)->getOrders($orderDetails);
Get specific Order
https://apidocs.shiprocket.in/?version=latest#aa23cc40-6ee8-4ce0-b0ab-1a7291514299
$token = Shiprocket::getToken(); $orderId = 16167171; $response = Shiprocket::order($token)->find($orderId);
Create Custom Order
https://apidocs.shiprocket.in/?version=latest#247e58f3-37f3-4dfb-a4bb-b8f6ab6d41ec
$orderDetails = [ // refer above url for required parameters ]; $token = Shiprocket::getToken(); $response = Shiprocket::order($token)->create($orderDetails);
Create Channel Specific Order
https://apidocs.shiprocket.in/?version=latest#45126d19-74ed-4cf5-9447-8ac1041bbb3c
$orderDetails = [ // refer above url for required parameters ]; $channelSpecificOrder = true; $response = Shiprocket::order($token)->create($orderDetails,$channelSpecificOrder);
Create quick order ( Wrapper API )
This is an all in one API to create an order, ship the order, add a new pickup location and generate label along with the manifest for the same. Create, Ship and Generate Label and Manifest for Order
https://apidocs.shiprocket.in/?version=latest#7bd788f4-63ba-49c3-889e-960a379d090f
$orderDetails = [ // refer aboce url for required parameters ]; $response = Shiprocket::order($token)->quickCreate($orderDetails);
Cancel an order
https://apidocs.shiprocket.in/?version=latest#5c0e41ca-d868-44c4-8ddb-73a8de239401
$ids = [12345,12346]; $response = Shiprocket::order($token)->cancel(['ids' => $ids]);
Update pickup location
https://apidocs.shiprocket.in/?version=latest#4ba045ab-e25b-4bb1-adbd-37bbd07b354e
$orderDetails = [ 'order_id' => [12345,123456 ] 'pickup_location' => 'location name' ]; $response = Shiprocket::order($token)->updatePickupLocation($orderDetails);
Couriers
Use these API's to assign AWB to your order, check for courier serviceability, and request for the pickup of your order. https://apidocs.shiprocket.in/?version=latest#a091dfc1-f882-466a-96a1-e245d3c80c5b
Generate AWB for Shipment
https://apidocs.shiprocket.in/?version=latest#b267ca9a-f7aa-4edc-8477-7dc15e46e08a
$data = [ 'shipment_id' => '', 'courier_id' => '' ]; $response = Shiprocket::courier($token)->generateAWB($data); // for more details visit above url
Check Courier Serviceability
https://apidocs.shiprocket.in/?version=latest#29ff5116-0917-41ba-8c82-638412604916
$pincodeDetails = [ // for paramets refer obove url. ]; $response = Shiprocket::courier($token)->checkServiceability($pincodeDetails);
Check International Courier Serviceability
https://apidocs.shiprocket.in/?version=latest#6d1f2fb0-43c1-434f-8c93-50674a0b59ef
$pincodeDetails = [ // for paramets refer obove url. ]; $response = Shiprocket::courier($token)->checkInterNationalServiceability($pincodeDetails);
Request for Shipments Pickup
https://apidocs.shiprocket.in/?version=latest#9f42cdfd-a055-4934-a0f4-86764f87c80d
$pickupDetails = [ // for paramets refer obove url. ]; $response = Shiprocket::courier($token)->requestPickup($pickupDetails);
Shipments
https://apidocs.shiprocket.in/?version=latest#0f9a75fd-6d23-453c-a3d7-85857e8c8759
Get the all shipment details
https://apidocs.shiprocket.in/?version=latest#a9913eaf-94ba-4012-a105-9687fddc7221
$filterParam = []; // you can use sort, sort_by, filter,filter_by $shipments = Shiprocket::shipment($token)->get();
Get the details of a specific Shipment
https://apidocs.shiprocket.in/?version=latest#5f9bced5-4f16-4868-be55-a8c0215d0711
$shipemntId = 1232122; $shipments = Shiprocket::shipment($token)->getSpecific($shipemntId);
Tracking
Use these API's to get the tracking details of your shipments through the AWB code or the Shipment ID. https://apidocs.shiprocket.in/?version=latest#62304450-5d27-4a28-929f-6c68d08040aa
Get Tracking through AWB
https://apidocs.shiprocket.in/?version=latest#f2ac0962-4c34-4fe4-8266-50f8a1e8eab0
$awb = 1234444222; $response = Shiprocket::track($token)->throughAwb($awb);
Get Tracking Data for Multiple AWBS
https://apidocs.shiprocket.in/?version=latest#cf273e6a-08d0-4624-bf7a-7510c28292e0
$awbs = ["788830567028","788829354408"]; $response = Shiprocket::track($token)->throwMultipleAwb($awb);
Get Tracking through Shipment ID
https://apidocs.shiprocket.in/?version=latest#89005f4f-2b2f-473d-95b0-f54665a16b42
$shipmentId = 123213; $response = Shiprocket::track($token)->throwShipmentId($shipmentId);
Get Tracking Data through Order iD
https://apidocs.shiprocket.in/?version=latest#bfcf3357-4e39-4134-831a-1ff33f67205e
$orderId = 123213; $channelID = 121; //optional $shipment = Shiprocket::track($token)->throwOrderId($orderId,$channelID);
Pickup-Addresses
https://apidocs.shiprocket.in/?version=latest#6949d954-d0ba-4749-99aa-2435ab7aaf4f
Add a New Pickup Location
https://apidocs.shiprocket.in/?version=latest#6fbe81f5-c3d5-462e-b18f-d6316dde7779
$newLocation = []; //Refer the above url for required parameteres $location = Shiprocket::pickup($token)->addLocation($newLocation);
Get All Pickup Locations
https://apidocs.shiprocket.in/?version=latest#3bd67de6-8f00-435f-a708-c0c3ab252fee
$location = Shiprocket::pickup($token)->getLocations();
Channels
https://apidocs.shiprocket.in/?version=latest#6233e207-6de3-4960-a59c-b34ebe3fe33d
To get details about all the integrated channels
https://apidocs.shiprocket.in/?version=latest#b9b9bcbe-923c-4ccd-a46e-d9f089622a80
$channels = Shiprocket::channel($token)->get();
Manifest/Generate-Labels/Print-Invoice
https://apidocs.shiprocket.in/?version=latest#a9f708ec-5861-43b9-a510-8c1bba074cb5
Generate the manifest of orders using shipment Id's
https://apidocs.shiprocket.in/?version=latest#dc281151-33e6-485f-a76a-015d8d36b49f
$shipmentIds = [ 'shipment_id' => [121221,122112] ]; $manifestDetails = Shiprocket::generate($token)->manifest(shipmentIds);
Print the Manifest (Mnaifest needs to be generated first in order for this API to print it. Use the 'Generate Manifest' API to do the same)
https://apidocs.shiprocket.in/?version=latest#dd1e168b-6bb2-45b9-a930-68cae3cbe97c
$orderIds = [ 'order_ids' => [121221,122112] ]; $response = Shiprocket::generate($token)->printManifest(orderIds);
Generate the label of an order by passing the shipment id in the form of an array
https://apidocs.shiprocket.in/?version=latest#4dfcbd78-4789-4680-82bf-9ff07f56d34e
$shipmentIds = [ 'shipment_id' => [121221,122112] ]; $response = Shiprocket::generate($token)->label(shipmentIds);
Generate the invoice for you're order.
https://apidocs.shiprocket.in/?version=latest#421f997f-1216-41e0-8c9b-433ddb666ad4
$orderIds = [ 'ids' => [121221,122112] ]; $response = Shiprocket::generate($token)->invoice(orderIds);
Products
https://apidocs.shiprocket.in/?version=latest#5046ae90-2014-4453-90d5-2ce776567f47
Get the all products
https://apidocs.shiprocket.in/?version=latest#0b8d1f26-3abd-4f4e-9cd8-3928bcfcf30b
$filterParam = []; // you can use sort, sort_by, filter,filter_by $shipments = Shiprocket::product($token)->get();
Get the details of a specific Product
https://apidocs.shiprocket.in/?version=latest#134f7710-660c-464f-b579-6da46ba9402f
$productId = 1232122; $shipments = Shiprocket::product($token)->getSpecific($productId);
Add New Products
https://apidocs.shiprocket.in/?version=latest#344b789d-584e-486a-a7a9-0cf33ce52bf3
$productDetails = [ // refer above url for required parameters ]; $response = Shiprocket::product($token)->create($productDetails);
NDR Shipments
Where you can get all the shipments that's are in NDR status
$response = Shiprocket::ndr($this->token)->getShipments(); // EX : GET : https://apiv2.shiprocket.in/v1/external/ndr/all where you can get all the shipments that are in NDR.
Where you can information of specific AWB which is in NDR
$awb_code = '0212331233322'; $response = Shiprocket::ndr($this->token)->getSpecificShipment($awb_code); // GET : https://apiv2.shiprocket.in/v1/external/ndr/{AWB} Where you can information of specific AWB which is in NDR
For open NDR where you can take action such as Reattempt, RTO :
$shipmentDetails = ['awb' => '', 'address_1' => '', 'address2' => '', 'phone' => '']; $response = Shiprocket::ndr($this->token)->reattempt($shipmentDetails); // POST : https://apiv2.shiprocket.in/v1/external/ndr/reattempt?awb=190729394&address1=Dr Nageshwar&address2=opposite Ashok Nagar&phone=9534952626&deferred_date=2020-08-27
Warehouse
Check Warehouse SRF serviceabbility
$filterParam = [ 'postcode' => 110030, // Delivery Post Code 'sku' => "SKU name", 'quantity' => 1, //Quantity in numbers ]; $response = Shiprocket::warehouse($this->token)->checkServiceability($filterParam); // EX : https://apiv2.shiprocket.in/v1/warehouse/srf-serviceability?postcode=784001&sku=Baby-socket&quantity=1 // Response : ['serviceability'=>true,'etd'=>'2020-12-06']
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Credits
Please feel free to contact me if you find any bug or create an issue for that!.
License
The MIT License (MIT). Please see License File for more information.
seshac/laravel-shiprocket-api 适用场景与选型建议
seshac/laravel-shiprocket-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 29.48k 次下载、GitHub Stars 达 28, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「sesha」 「laravel Shiprcoket Api」 「Laravel Shiprocket Wrapper」 「Shiprocket SDK Module」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 seshac/laravel-shiprocket-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 seshac/laravel-shiprocket-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 seshac/laravel-shiprocket-api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Alfabank REST API integration
Shiprocket API (V1) Laravel SDK. Integration of Shiprocket API in your laravel application is easy, This package enables you to utilize most of your Shiprocket functions.
Laravel package for Accurate Online API integration.
Shared RCX Laravel DataTables UI and configuration helpers.
Boot a Laravel project on any machine with one command: app:serve installs missing tools (PHP, Node, Composer, Herd, Docker), creates .env, sets up the database, runs migrations, builds assets, starts a queue worker and serves via Herd, Sail or artisan serve; app:down cleanly stops everything it sta
Branded, diagnostic error pages (500, 403, 404, 419, 503) for Filament — native Filament UI, dark mode and translations out of the box.
统计信息
- 总下载量: 29.48k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 28
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 未知