PHP code example of na0260 / pathao-api-laravel-package

1. Go to this page and download the library: Download na0260/pathao-api-laravel-package 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/ */

    

na0260 / pathao-api-laravel-package example snippets


$cities = Pathao::cities();
$zones = Pathao::zones($cityId);
$areas = Pathao::areas($zoneId);

$store = Pathao::createStore([
    'name' => 'Test Store',
    'contact_name' => 'John Doe',
    'contact_number' => '017XXXXXXXX',
    'address' => 'House 123, Road 4, Dhaka',
    'city_id' => {{city_id}},
    'zone_id' => {{zone_id}},
    'area_id' => {{area_id}},
]);

$stores = Pathao::storeInfo();

$order = Pathao::createOrder([
    'store_id' => {{merchant_store_id}},
    'merchant_order_id' => "{{merchant_order_id}}",
    'recipient_name' => 'John Doe',
    'recipient_phone' => '017XXXXXXXX',
    'recipient_address' => 'House 123, Road 4, Dhaka',
    'delivery_type' => {{48 for Normal Delivery, 12 for On Demand Delivery}},
    'item_type' => {{1 for Document, 2 for Parcel}},
    'item_quantity' => {{Quantity of your parcels}},
    'item_weight' => {{Minimum 0.5 KG to Maximum 10 KG}},
    'item_description' => 'Test item',
    'amount_to_collect' => {{Recipient Payable Amount. Default should be 0 in case of NON Cash-On-Delivery(COD)The collectible amount from the customer.}},
]);

$orders = [$order1, $order2];
$response = Pathao::createBulkOrder($orders);

$orderInfo = Pathao::orderInfo($consignmentId);

$price = Pathao::priceCalculator([
    'store_id' => {{merchant_store_id}},
    'item_type' => {{1 for Document, 2 for Parcel}},
    'delivery_type' => {{48 for Normal Delivery, 12 for On Demand Delivery}},
    'item_weight' => {{Minimum 0.5 KG to Maximum 10 KG}},
    'recipient_city' => {{city_id}},
    'recipient_zone' => {{zone_id}},
]);
bash
php artisan vendor:publish --provider="Nur\Pathao\PathaoServiceProvider" --tag="config"