developifynet/leopardscod-php
Composer 安装命令:
composer require developifynet/leopardscod-php
包简介
Leopards Courier COD (Cash on Delivery) API Wrapper for PHP
关键字:
README 文档
README
This composer package offers quick booking packets via APIs on Leopards COD (Cash on Delivery) for your Laravel applications.
Installation
Begin by pulling in the package through Composer.
composer require developifynet/leopardscod-php
Laravel Framework Usage
Within your controllers, you can call LeopardsCOD facade and can send perform different operations.
Set Credentials
use \Developifynet\LeopardsCOD\LeopardsCOD; public function index() { LeopardsCOD::setCredentials(array( 'api_key' => '<your_api_key>', // API Key provided by LCS 'api_password' => '<your_api_password>', // API Password provided by LCS 'enable_test_mode' => true, // [Optional] default value is 'false', true|false to set mode test or live )); }
or setting up with data. See below endpoints where credentials are porvided within function data
Get All Cities
use \Developifynet\LeopardsCOD\LeopardsCOD; public function index() { $response = LeopardsCOD::setCredentials(array( 'api_key' => '<your_api_key>', // API Key provided by LCS 'api_password' => '<your_api_password>', // API Password provided by LCS 'enable_test_mode' => true, // [Optional] default value is 'false', true|false to set mode test or live ))->getAllCities(); }
Book a Packet
use \Developifynet\LeopardsCOD\LeopardsCOD; public function index() { $response = LeopardsCOD::setCredentials(array( 'api_key' => '<your_api_key>', // API Key provided by LCS 'api_password' => '<your_api_password>', // API Password provided by LCS 'enable_test_mode' => true, // [Optional] default value is 'false', true|false to set mode test or live ))->bookPacket(array( 'booked_packet_weight' => '200', 'booked_packet_vol_weight_w' => '', 'booked_packet_vol_weight_h' => '', 'booked_packet_vol_weight_l' => '', 'booked_packet_no_piece' => '1', 'booked_packet_collect_amount' => '1000', 'booked_packet_order_id' => '1001', 'origin_city' => 'string', /** Params: 'self' or 'integer_value' e.g. 'origin_city' => 'self' or 'origin_city' => 789 (where 789 is Lahore ID) * If 'self' is used then Your City ID will be used. * 'integer_value' provide integer value (for integer values read 'Get All Cities' api documentation) */ 'destination_city' => 'string', /** Params: 'self' or 'integer_value' e.g. 'destination_city' => 'self' or 'destination_city' => 789 (where 789 is Lahore ID) * If 'self' is used then Your City ID will be used. * 'integer_value' provide integer value (for integer values read 'Get All Cities' api documentation) */ // Shipper Information 'shipment_name_eng' => 'self', 'shipment_email' => 'self', 'shipment_phone' => 'self', 'shipment_address' => 'self', // Consingee Information 'consignment_name_eng' => 'John Doe', 'consignment_email' => 'johndoe@example.com', 'consignment_phone' => '+923330000000', 'consignment_address' => 'Test Address is used here', 'special_instructions' => 'n/a', )); }
Track Packet(s)
use \Developifynet\LeopardsCOD\LeopardsCOD; public function index() { $response = LeopardsCOD::setCredentials(array( 'api_key' => '<your_api_key>', // API Key provided by LCS 'api_password' => '<your_api_password>', // API Password provided by LCS 'enable_test_mode' => true, // [Optional] default value is 'false', true|false to set mode test or live ))->trackPacket(array( 'track_numbers' => 'LEXXXXXXXX', // E.g. 'XXYYYYYYYY' OR 'XXYYYYYYYY,XXYYYYYYYY,XXYYYYYY' 10 Digits each number )); }
Other Usage
Within your controllers, you can call LeopardsCODClient Object and call approperiate functions for your need.
You can set credentials in various ways. See below
Set Credentials
use \Developifynet\LeopardsCOD\LeopardsCODClient; public function index() { $leopards = new LeopardsCODClient(array( 'api_key' => '<your_api_key>', // API Key provided by LCS 'api_password' => '<your_api_password>', // API Password provided by LCS 'enable_test_mode' => true, // [Optional] default value is 'false', true|false to set mode test or live )); }
or using 'setCredentials'
use \Developifynet\LeopardsCOD\LeopardsCODClient; public function index() { $leopards = new LeopardsCODClient(); $leopards->setCredentials(array( 'api_key' => '<your_api_key>', // API Key provided by LCS 'api_password' => '<your_api_password>', // API Password provided by LCS 'enable_test_mode' => true, // [Optional] default value is 'false', true|false to set mode test or live )); }
or setting up with data. See below endpoints where credentials are porvided within function data
Get All Cities
use \Developifynet\LeopardsCOD\LeopardsCODClient; public function index() { $leopards = new LeopardsCODClient(); $response = $leopards->getAllCities(array( 'api_key' => '<your_api_key>', // API Key provided by LCS 'api_password' => '<your_api_password>', // API Password provided by LCS 'enable_test_mode' => true, // [Optional] default value is 'false', true|false to set mode test or live )); }
Book a Packet
use \Developifynet\LeopardsCOD\LeopardsCODClient; public function index() { $leopards = new LeopardsCODClient(); $response = $leopards->bookPacket(array( 'api_key' => '<your_api_key>', // API Key provided by LCS 'api_password' => '<your_api_password>', // API Password provided by LCS 'enable_test_mode' => true, // [Optional] default value is 'false', true|false to set mode test or live 'booked_packet_weight' => '200', 'booked_packet_vol_weight_w' => '', 'booked_packet_vol_weight_h' => '', 'booked_packet_vol_weight_l' => '', 'booked_packet_no_piece' => '1', 'booked_packet_collect_amount' => '1000', 'booked_packet_order_id' => '1001', 'origin_city' => 'string', /** Params: 'self' or 'integer_value' e.g. 'origin_city' => 'self' or 'origin_city' => 789 (where 789 is Lahore ID) * If 'self' is used then Your City ID will be used. * 'integer_value' provide integer value (for integer values read 'Get All Cities' api documentation) */ 'destination_city' => 'string', /** Params: 'self' or 'integer_value' e.g. 'destination_city' => 'self' or 'destination_city' => 789 (where 789 is Lahore ID) * If 'self' is used then Your City ID will be used. * 'integer_value' provide integer value (for integer values read 'Get All Cities' api documentation) */ // Shipper Information 'shipment_name_eng' => 'self', 'shipment_email' => 'self', 'shipment_phone' => 'self', 'shipment_address' => 'self', // Consingee Information 'consignment_name_eng' => 'John Doe', 'consignment_email' => 'johndoe@example.com', 'consignment_phone' => '+923330000000', 'consignment_address' => 'Test Address is used here', 'special_instructions' => 'n/a', )); }
Track Packet(s)
use \Developifynet\LeopardsCOD\LeopardsCODClient; public function index() { $leopards = new LeopardsCODClient(); $response = $leopards->trackPacket(array( 'api_key' => '<your_api_key>', // API Key provided by LCS 'api_password' => '<your_api_password>', // API Password provided by LCS 'enable_test_mode' => true, // [Optional] default value is 'false', true|false to set mode test or live 'track_numbers' => 'LEXXXXXXXX', // E.g. 'XXYYYYYYYY' OR 'XXYYYYYYYY,XXYYYYYYYY,XXYYYYYY' 10 Digits each number )); }
developifynet/leopardscod-php 适用场景与选型建议
developifynet/leopardscod-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 361 次下载、GitHub Stars 达 10, 最近一次更新时间为 2019 年 08 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「package」 「php」 「api」 「sdk」 「sdk-php」 「leopards」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 developifynet/leopardscod-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 developifynet/leopardscod-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 developifynet/leopardscod-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PSR-7 compatible library for making CRUD API endpoints
Simple ASCII output of array data
Alfabank REST API integration
Package for view storage in laravel
User Approval Laravel Package
统计信息
- 总下载量: 361
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-08-01