PHP code example of mchervenkov / inout

1. Go to this page and download the library: Download mchervenkov/inout 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/ */

    

mchervenkov / inout example snippets



// Init Inout Client
$inout = new Inout();

// Awb endpoints
$inout->awbDetails($awbNumber);
$inout->awbStatus($awbNumber);
$inout->awbPrint($awbNumber, 1);
$inout->awbHistory($awbNumber);
$inout->pickupAwbCreation(PickupAwbCreation);

// Companies endpoints
$inout->getCompanies();

// Couriers endpoints
$inout->getCouriers();
$inout->getCourierOffices($courierId);

// Locations endpoints
$inout->getCounties($countryId);
$inout->getCities(City, $countryId);
$inout->getCountries();
$inout->getCitiesSuggestions($countryId, $searchString, 1);

// Shipments endpoints
$inout->shipmentCreation(Shipment)
$inout->shipmentPrice(ShipmentPrice)

// Additional services endpoints
$inout->codInformation($referenceNumber)
$inout->phoneCallHistory($awbNumber)
$inout->waybillsHistory(WaybillsHistory)

InoutCity
InoutCompanyCourier
InoutCountry
InoutCounty
InoutCourierOffice
InoutApiStatus
CarrierCityMap

$inout = new Inout();
$shipment = new \Mchervenkov\Inout\Hydrators\Shipment([
    "senderId" => 333,
    "courierId" => 20,
    "waybillAvailableDate" => "2023-06-29",
    "serviceName" => "crossborder",
    "recipient": [
        "name" => "Test User", //Name of recipient or company. Typically, both customer names (first name and last name) or company.
        "countryIsoCode" => "HU", //Two digits country ISO code.
        "cityId" => 20144281, //The ID of a city where the shipment needs to delivery. Obtain an ID from Cities_Web_Service_v1.0. Using cityId, cityName and zipCode can be null.
        "region" => "null", //The Municipality/county were the city is located.
        "cityName" => "Balatonszárszó", //City name. If you have your own nomenclature with а cities, you can fill in the fields cityName, zipCode and region.
        "zipCode" => "8624", //Zip code.
        "streetName"  => "test street", //Name of the street, office address or office name - e.g. If you create shipment to address - Main street or Main street 10.If you want to create shipment to an office, please add a keyword "to office: " to office name or office address.
        "buildingNumber" => 0, //Number of the street/building - e.g. 10
        "officeId" => 1297, //if the courier support PUDO delivery, you can send ID of the PUDO. Obtain the PUDO ID'\''s from "Courier_Offices_Web_Service_v1.2"
        "officeCode" => "1182", //if the courier support PUDO delivery, you can send COURIER_OFFICE_CODE of the PUDO. Obtain the PUDO COURIER_OFFICE_CODE'\''s from "Courier_Offices_Web_Service_v1.2"
        "addressText" => "additional text, address test", //Additional address information – e.g. бл.25 ет 3. or bl.25 et. 3 *NOT ALL COURIERS SUPPORT IT*
        "contactPerson" => "Test User", //Contact person. Usually is the same as the name of recipient.
        "phoneNumber" => "00889000000", //Recipient'\''s phone number - mandatory for all coureirs.
        "email" => "[email protected]" // Recipient'\''s email - highly recomended
    ],
    "awb": [
        "shipmentType" => "pack", //pack or pallet
        "parcels" => 1, // Number of parcels in the shipment. *NOT ALL COURIERS SUPPORT MULTIPARCEL SERVICE*
        "envelopes" => 0, //Always send "0".
        "totalWeight" => 1.000, //Total weight of the shipment in kg. The value have to be equal to the sum of all packages.
        "declaredValue" => 0, //Insurance amount of the shipment. *NOT ALL COURIERS SUPPORT THE SERVICE*
        "bankRepayment" => 0.0, //COD amount of the shipment in local currency. You can set to 0 if the shipment doesn'\''t have a COD amount.
        "otherRepayment" => "additional text for repayment",//The service is no longer supported
        "observations" => "notes", //Additional information about the shipment/products. (notes)
        "openPackage" => false, //Check up the shipment before pay.
        "shipmentPayer" => "sender", //Always "sender"
        "saturdayDelivery" => false, //The service is no longer supported
        "referenceNumber" => "000000", //Client reference number. Important: The information in the field must be unique to avoid duplicate shipments!
        "products" => "test product", //The content of the shipment. e.g. product1 product2
        "fragile": 1, //Marker whether the content is fragile. (fragile = 1 if the content is fragile) – Used only for BG
        "productsInfo" => "1111;2222;3333;4444", //Аdditional product information.
        "piecesInPack" => 4, //Products amount in one shipment. e.g If the shipment contain 5 products the field will be filled with 5.
        "packages" => [
            "1": [
                "dimensions" => [
                    "width" => 20,
                    "height" => 20,
                    "length" => 20
                ],
                "weight" => 2.300
            ]
        ]
    ],
    "returnLabel" => [
        "nDaysValid" => 0 //By default is 0 (infinity). FUsed only for Greece
    ]
]);

$response = $inout->shipmentCreation($shipment);
dd($response);

bash
php artisan migrate
bash
php artisan vendor:publish --tag=inout-config
bash
php artisan vendor:publish --tag=inout-migrations
bash
php artisan vendor:publish --tag=inout-models
bash
php artisan vendor:publish --tag=inout-commands