1. Go to this page and download the library: Download alhoqbani/smsa-webservice 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/ */
use \Alhoqbani\SmsaWebService\Smsa;
use \Alhoqbani\SmsaWebService\Models\Shipment;
use \Alhoqbani\SmsaWebService\Models\Customer;
use \Alhoqbani\SmsaWebService\Models\Shipper;
$smsa = new Smsa($passKey);
// Create a customer
$customer = new Customer(
'Customer Name', //customer name
'0500000000', // mobile number. must be > 9 digits
'10 King Fahad Road', // street address
'Jeddah' // city
);
$shipment = new Shipment(
time(), // Refrence number
$customer, // Customer object
Shipment::TYPE_DLV // Shipment type.
);
$awb = $smsa->createShipment($shipment);
echo $awb->data; // 290019315792
$customer
->setEmail('[email protected]')
->setAddressLine2('Building 10, Apartment 1')
->setPOBox('12345')
->setZipCode('11411')
->setTel1('0110000000')
->setTel2('0120000000');
// To add shipper details to the shipment
$shipper = new Shipper(
'Shipper Name (LLC)', // shipper name
'Shipper Employee', // contact name
'1 Main Road', // address line 1
'Riyadh', // city
'Saudi Arabia', // country
'0110000000' // phone
);
$shipment->setShipper($shipper);