Documentation

Util
in package

Table of Contents

convertEasyPostObjectToArray()  : array<string|int, mixed>
Convert EasyPost object to an array.
getLowestSmartRate()  : Rate
Get the lowest SmartRate from a list of SmartRates.
getLowestStatelessRate()  : Rate
Get the lowest stateless rate.
receiveEvent()  : mixed
Receive an event (convert JSON string to object).
validateWebhook()  : mixed
Validate a webhook originated from EasyPost by comparing the HMAC header to a shared secret.

Methods

convertEasyPostObjectToArray()

Convert EasyPost object to an array.

public static convertEasyPostObjectToArray(mixed $values) : array<string|int, mixed>
Parameters
$values : mixed
Return values
array<string|int, mixed>

getLowestSmartRate()

Get the lowest SmartRate from a list of SmartRates.

public static getLowestSmartRate(array<string|int, Rate$smartRates, int $deliveryDays, string $deliveryAccuracy) : Rate

To exclude a carrier or service, prepend the string with !.

Parameters
$smartRates : array<string|int, Rate>
$deliveryDays : int
$deliveryAccuracy : string
Tags
throws
EasyPostException
Return values
Rate

getLowestStatelessRate()

Get the lowest stateless rate.

public static getLowestStatelessRate(array<string|int, Rate$statelessRates[, array<string|int, string> $carriers = [] ][, array<string|int, string> $services = [] ]) : Rate

To exclude a carrier or service, prepend the string with !.

Parameters
$statelessRates : array<string|int, Rate>
$carriers : array<string|int, string> = []
$services : array<string|int, string> = []
Tags
throws
EasyPostException
Return values
Rate

receiveEvent()

Receive an event (convert JSON string to object).

public static receiveEvent([string|null $rawInput = null ]) : mixed
Parameters
$rawInput : string|null = null
Tags
throws
EasyPostException
Return values
mixed

validateWebhook()

Validate a webhook originated from EasyPost by comparing the HMAC header to a shared secret.

public static validateWebhook(mixed $eventBody, mixed $headers, string $webhookSecret) : mixed

If the signatures do not match, an error will be raised signifying the webhook either did not originate from EasyPost or the secrets do not match. If the signatures do match, the event_body will be returned as JSON

Parameters
$eventBody : mixed
$headers : mixed
$webhookSecret : string
Tags
throws
EasyPostException
Return values
mixed

Search results