1. Go to this page and download the library: Download matyo-17/lalamove library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
matyo-17 / lalamove example snippets
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");
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.