developifynet / leopardscod-php
LeopardsCourierCOD(货到付款)API包装器,适用于PHP
v2.0
2023-12-29 12:52 UTC
Requires
- php: >=5.4.0
- guzzlehttp/guzzle: ~6.0
- illuminate/support: ~5.0
Requires (Dev)
- mockery/mockery: dev-master
- phpunit/phpunit: ^6.1
This package is auto-updated.
Last update: 2024-09-29 14:32:08 UTC
README
此composer包通过LeopardsCOD(货到付款)的API为您的Laravel应用程序提供快速预订包。
安装
首先,通过Composer引入此包。
composer require developifynet/leopardscod-php
Laravel框架使用
在您的控制器中,您可以调用LeopardsCOD外观并执行不同的操作。
设置凭据
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 )); }
或使用数据设置。请参见下文端点,其中凭据在函数数据中提供
获取所有城市
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(); }
预订包
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', )); }
跟踪包
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 )); }
其他使用
在您的控制器中,您可以调用LeopardsCODClient对象并调用满足您需求的适当函数。
您可以通过多种方式设置凭据。请参见下文
设置凭据
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 )); }
或使用'设置凭据'
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 )); }
或使用数据设置。请参见下文端点,其中凭据在函数数据中提供
获取所有城市
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 )); }
预订包
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', )); }
跟踪包
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 )); }