guti/dhl-tracker

The DHLTracker PHP package provides an easy-to-use, object-oriented interface for tracking shipments using the DHL API.

dev-main 2023-12-30 19:08 UTC

This package is auto-updated.

Last update: 2024-10-30 02:05:30 UTC


README

Description

The DHLTracker PHP package provides an easy-to-use, object-oriented interface for tracking shipments using the DHL API. It simplifies the process of sending requests to DHL and parsing the responses. This package is particularly useful for developers working on logistics, e-commerce, and any application where tracking DHL shipments is required.

Features

  • Simple Tracking: Track DHL shipments using just the tracking number.
  • API Key Integration: Securely integrates with your DHL API key for authenticated requests.
  • Error Handling: Implements error handling for robust application development.
  • Flexible Responses: Retrieve tracking information in a structured format, making it easy to use within your application.
  • PSR-4 Autoloading: Conforms to PSR-4 standards for compatibility with modern PHP applications.

Installation

The DHLTracker PHP package can be installed using Composer. Run this command:

composer require dhltracker/dhltracker

Usage

Tracking Shipments

To track a shipment, you will need to create a DHLTracker object and pass in your DHL API key and the tracking number. You can then call the trackShipment() method and this will return a DHLTrackerResponse object, which contains the tracking information.

<?php

require_once __DIR__ . '/vendor/autoload.php';

use DHLTracker\DHLTracker;

// Instantiate the DHLTracker class with your DHL tracking number and API key:

$tracker = new DHLTracker("YOUR_TRACKING_NUMBER", "YOUR_DHL_API_KEY");

// Then, use the trackShipment method to get the tracking information:

$response = $tracker->trackShipment();
echo $response;

?>

Requirements

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for more details.

License

This package is licensed under the MIT License