PHP code example of ahid-technologies / leopards-courier
1. Go to this page and download the library: Download ahid-technologies/leopards-courier 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/ */
ahid-technologies / leopards-courier example snippets
use Ahid\LeopardsCourier\Facades\LeopardsCourier;
// Get all cities
$cities = LeopardsCourier::getAllCities();
use Ahid\LeopardsCourier\Facades\LeopardsCourier;
// Book a packet
$bookingData = [
'booked_packet_weight' => 2000, // Weight in grams
'booked_packet_no_piece' => 1,
'booked_packet_collect_amount' => 2500,
'booked_packet_order_id' => 'ORD-12345',
'origin_city' => 'self', // or city ID
'destination_city' => 789, // City ID from getAllCities
'shipment_name_eng' => 'self',
'shipment_email' => 'self',
'shipment_phone' => 'self',
'shipment_address' => 'self',
'consignment_name_eng' => 'John Doe',
'consignment_email' => '[email protected]',
'consignment_phone' => '03001234567',
'consignment_address' => '123 Main St, Lahore',
'special_instructions' => 'Handle with care'
];
$booking = LeopardsCourier::bookPacket($bookingData);
use Ahid\LeopardsCourier\Exceptions\LeopardsApiException;
try {
$cities = LeopardsCourier::getAllCities();
} catch (LeopardsApiException $e) {
// Handle API error
echo $e->getMessage();
}