stdmedoth/lalamove-php-sdk 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

stdmedoth/lalamove-php-sdk

最新稳定版本:1.0.0

Composer 安装命令:

composer require stdmedoth/lalamove-php-sdk

包简介

The LalamovePHP-SDK repository is the ideal solution for PHP developers looking to integrate Lalamove's on-demand delivery functionality into their applications.

README 文档

README

The LalamovePHP-SDK is a PHP library that provides an easy-to-use interface for developers to connect to Lalamove's on-demand delivery service. With this SDK, developers can authenticate, create quotations, create orders, and retrieve order details.

Authentication

To use the LalamovePHP-SDK, you must first authenticate with Lalamove's API. You can obtain your API credentials from the Lalamove developer portal. Once you have your credentials, you can create an instance of the SDK and set your API key, API secret, market, and environment:

require_once 'vendor/autoload.php';

use stdmedoth\LalamovePhpSdk;

$api_key = 'YOUR_API_KEY';
$api_secret = 'YOUR_API_SECRET';
$market = 'YOUR_MARKET'; // e.g. 'SG'
$environment = 'YOUR_ENVIRONMENT'; // either 'product' or 'sandbox'

$lalamove = new LalamovePhpSdk($api_key, $api_secret, $market, $environment);

Creating a Quotation

To create a quotation, you need to provide the following information:

  • serviceType: Type of service. This parameter is required and can be obtained from the services endpoint.
  • stops: An array of stops objects containing pickup and dropoff information, including the location coordinates (latitude and longitude) and the address of each stop.
  • language: Language used to return the quotation. This parameter is optional and can be set to en_US by default.
  • item: An object containing information about the item being delivered, including quantity, weight, categories, and handling instructions. This parameter is optional.

Here's an example code snippet to create a quotation:

$serviceType = $possible_service->key;
$stops = [(object)[
    'coordinates' => (object)[
        'lat' => "-23.6008754",
        'lng' => "-46.6521289"
    ],
    'address' => 'Alameda Anapurus'
], (object)[
    'coordinates' => (object)[
        'lat' => "$location->lat",
        'lng' => "$location->lng",
    ],
    'address' => $package['destination']['address']
]];
$item = (object)[
    "quantity" => "$quantity",
    "weight" => "LESS_THAN_3KG",
    "categories" => ["FOOD_DELIVERY", "OFFICE_ITEM"],
    "handlingInstructions" => ["KEEP_UPRIGHT"]
];
$response = $lalamove_api->quotations($serviceType, $stops, $language, $item);
$quotation = $response->data;

统计信息

  • 总下载量: 12
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2023-02-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固