DHLShippingProvider
extends AbstractShippingProvider
in package
DHL Shipping Provider implementation.
Handles DHL tracking number detection and validation for all DHL services.
Table of Contents
- $major_operation_countries : array<string|int, mixed>
- List of countries where DHL has significant operations.
- can_ship_from() : bool
- Check if the shipping provider can ship from a specific country.
- can_ship_from_to() : bool
- Checks if DHL can ship between two countries.
- can_ship_to() : bool
- Check if the shipping provider can ship to a specific country.
- get_icon() : string
- Gets the path to the provider's icon.
- get_key() : string
- Gets the unique provider key.
- get_name() : string
- Gets the display name of the provider.
- get_shipping_from_countries() : array<string|int, string>
- Gets the list of origin countries supported by DHL.
- get_shipping_to_countries() : array<string|int, string>
- Gets the list of destination countries supported by DHL.
- get_tracking_url() : string
- Generates the appropriate tracking URL based on DHL service type.
- try_parse_tracking_number() : array<string|int, mixed>|null
- Validates and parses a DHL tracking number.
Properties
$major_operation_countries
List of countries where DHL has significant operations.
private
array<string|int, mixed>
$major_operation_countries
= array('DE', 'US', 'CA', 'GB', 'SG', 'JP', 'HK', 'NL', 'FR', 'IT', 'AU', 'CN', 'IN', 'ES', 'BE', 'CH', 'AT', 'SE', 'DK', 'NO', 'PL', 'CZ', 'FI', 'IE', 'PT', 'GR', 'HU', 'RO', 'BG', 'HR', 'SK', 'SI', 'LT', 'LV', 'EE', 'CY', 'MT', 'LU')
Methods
can_ship_from()
Check if the shipping provider can ship from a specific country.
public
can_ship_from(string $country_code) : bool
Parameters
- $country_code : string
-
The country code to check.
Return values
bool — True if the provider can ship from the country, false otherwise.can_ship_from_to()
Checks if DHL can ship between two countries.
public
can_ship_from_to(string $shipping_from, string $shipping_to) : bool
Parameters
- $shipping_from : string
-
Origin country code.
- $shipping_to : string
-
Destination country code.
Return values
bool — True if shipping route is supported.can_ship_to()
Check if the shipping provider can ship to a specific country.
public
can_ship_to(string $country_code) : bool
Parameters
- $country_code : string
-
The country code to check.
Return values
bool — True if the provider can ship to the country, false otherwise.get_icon()
Gets the path to the provider's icon.
public
get_icon() : string
Return values
string — URL to the DHL logo image.get_key()
Gets the unique provider key.
public
get_key() : string
Return values
string — The provider key 'dhl'.get_name()
Gets the display name of the provider.
public
get_name() : string
Return values
string — The provider name 'DHL'.get_shipping_from_countries()
Gets the list of origin countries supported by DHL.
public
get_shipping_from_countries() : array<string|int, string>
Return values
array<string|int, string> — Array of country codes.get_shipping_to_countries()
Gets the list of destination countries supported by DHL.
public
get_shipping_to_countries() : array<string|int, string>
Return values
array<string|int, string> — Array of country codes.get_tracking_url()
Generates the appropriate tracking URL based on DHL service type.
public
get_tracking_url(string $tracking_number) : string
Parameters
- $tracking_number : string
-
The tracking number to generate URL for.
Return values
string — The complete tracking URL.try_parse_tracking_number()
Validates and parses a DHL tracking number.
public
try_parse_tracking_number(string $tracking_number, string $shipping_from, string $shipping_to) : array<string|int, mixed>|null
Parameters
- $tracking_number : string
-
The tracking number to validate.
- $shipping_from : string
-
Origin country code.
- $shipping_to : string
-
Destination country code.
