PHP code example of human018 / laravel-aus-post

1. Go to this page and download the library: Download human018/laravel-aus-post 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/ */

    

human018 / laravel-aus-post example snippets


use Human018\LaravelAusPost\AusPost

AusPost::domestic()
AusPost::international()

AusPost::domestic()
->parcelCalculate() // Tells the service we will be calculating for a Parcel (as opposed to a letter)
->fromPostcode // 4 digit origin postcode
->toPostcode // 4 digit destination postcode
->width() // mm
->height() // mm
->length() // mm
->weight() // grams
->usingService() // Provide one of the below service types
// AUS_PARCEL_EXPRESS
// AUS_PARCEL_REGULAR
->get() // Retrieves the result

Human018\LaravelAusPost\AusPost::domestic()->parcelCalculate()->fromPostcode(3000)->toPostcode(2000)->usingService('AUS_PARCEL_REGULAR')->get();

[
    "postage_result" => [
      "service" => "Parcel Post",
      "delivery_time" => "Delivered in 2-3 business days",
      "total_cost" => "10.60",
      "costs" => [
        "cost" => [
          "item" => "Parcel Post",
          "cost" => "10.60",
        ],
      ],
    ],
    "service" => [
      "service" => "AUS_PARCEL_REGULAR",
      "name" => "Regular Post",
      "description" => "Australia Post: Regular Parcel",
      "delivery_time" => "3-5 business days",
    ],
  ]