PHP code example of deliverymatch / sdk

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

    

deliverymatch / sdk example snippets


$client = new \DeliveryMatch\Sdk\Client(
    apikey: getenv("DM_API_KEY"),
    clientId: getenv("DM_CLIENT_ID"),
    environment: \DeliveryMatch\Sdk\HttpClient\ApiEnvironment::PRODUCTION
);

// For endpoints that are currently mapped in the sdk
$response = $client->shipments()->insert(new \DeliveryMatch\Sdk\Api\Dto\Request\ShipmentRequest(
    client: new \DeliveryMatch\Sdk\Api\Dto\Request\Client(...),
    customer: new \DeliveryMatch\Sdk\Api\Dto\Request\Customer(...),
    shipment: new \DeliveryMatch\Sdk\Api\Dto\Request\Shipment(...),
    packages: [new \DeliveryMatch\Sdk\Api\Dto\Request\Package(...)],
    products: [new \DeliveryMatch\Sdk\Api\Dto\Request\Product(... )],
    priceIncl: 19.95,
    weight: 20.0  
));


// For endpoints that are not (yet) available in the sdk
$request = [
    "shipment" => [
        "id" => 123
    ]
];

$response = $client->post("/getStatus", body: $request);