matyo-17/lalamove

Lalamove SDK

Installs: 11

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/matyo-17/lalamove

v1.0.1 2025-10-13 06:46 UTC

This package is auto-updated.

Last update: 2026-01-13 07:25:45 UTC


README

PHP SDK for Lalamove API

Minimum Requirements

Installation

composer require matyo-17/lalamove

Examples

require __DIR__.'/vendor/autoload.php';

use Carbon\Carbon;
use Matyo17\Lalamove\Lalamove;
use Matyo17\Lalamove\Coordinates;
use Matyo17\Lalamove\DeliveryDetails;
use Matyo17\Lalamove\DeliveryStops;
use Matyo17\Lalamove\Enums\Services;

// Initialise
$lalamove = new Lalamove(
    api_key: 'api_key',
    api_secret: 'api_secret',
    sandbox: false,
    market: 'MY'
);

// Make a quotation
$from = new DeliveryStops(
    coordinates: Coordinates::fromString("3.1427780826742193, 101.70046857079332"),
    address: "Warisan Merdeka Tower, Precinct, Kuala Lumpur City Centre, 50118 Kuala Lumpur, Federal Territory of Kuala Lumpur"
);
$to = new DeliveryStops(
    coordinates: Coordinates::fromString("3.1578402961856846, 101.71218381851456"),
    address: "Petronas Twin Tower, Kuala Lumpur City Centre, 50088 Kuala Lumpur, Federal Territory of Kuala Lumpur"
);
$quotation = $lalamove->makeQuotation(Services::CAR, [$from, $to], Carbon::now()->addHours());

// place an order
$sender = new DeliveryDetails(
    stop_id: $quotation['stops'][0]['stopId'],
    name: "Sender",
    phone: "+60123456789"
);
$receiver = new DeliveryDetails(
    stop_id: $quotation['stops'][1]['stopId'],
    name: "Receiver",
    phone: "+60123456789",
);
$order = $lalamove->placeOrder($quotation['quotationId'], $sender, [$receiver], true);

// get order details
$order_details = $lalamove->getOrder($order['orderId']);

// add priority fee
$priority_fee = $lalamove->addPriorityFee($order['orderId'], "10.00");

// get city info
$cities = $lalamove->getCityInfo();

// add webhook
$webhook = $lalamove->setWebhook("https://webhook.site/32e3c3d7-2175-4c4a-87d3-cd0c84a2bb5d");