Documentation

Address
in package
implements JsonSerializable

`Address` Type to be passed into the *validateAddress* method and internal **AddressService**.

Tags
throws
ValidationException

Interfaces, Classes and Traits

JsonSerializable

Table of Contents

$cityLocality  : string|null
The city or locality.
$cityLocality  : string|null
$company  : string|null
$company  : string|null
The company name, if this is a business address.
$countryCode  : string
$countryCode  : string
The ISO 3166 countryCode code
$isResidential  : bool|null
$isResidential  : bool|null
Indicates whether the address is isResidential or commercial, if known.
$name  : string|null
$name  : string|null
The name of the sender or recipient at the address, if applicable.
$phone  : string|null
The phone number associated with this address, if any.
$phone  : string|null
$postalCode  : string|null
$postalCode  : string|null
The postal code or zip code.
$stateProvince  : string|null
$stateProvince  : string|null
The state or province.
$street  : array<string|int, mixed>
$street  : array<string|int, mixed>
The street address. If the street address is multiple lines, then pass an array of lines (up to 3).
__construct()  : mixed
Address Type constructor. This object is used in the AddressService methods as the $params object that gets passed in.
jsonSerialize()  : mixed
Returns an array that can be easily JsonSerialized using `json_encode()` which will yield a JSON string representation of the `Address` Type.
validateInput()  : void
Assertions to validate that the address array items are in the type/format we need them to be.

Properties

$cityLocality

The city or locality.

public string|null $cityLocality

$cityLocality

public string|null $cityLocality

$company

The company name, if this is a business address.

public string|null $company

$countryCode

public string $countryCode

$isResidential

public bool|null $isResidential

$isResidential

Indicates whether the address is isResidential or commercial, if known.

public bool|null $isResidential

$name

The name of the sender or recipient at the address, if applicable.

public string|null $name

$phone

The phone number associated with this address, if any.

public string|null $phone

$postalCode

public string|null $postalCode

$postalCode

The postal code or zip code.

public string|null $postalCode

$stateProvince

public string|null $stateProvince

$stateProvince

The state or province.

public string|null $stateProvince

$street

public array<string|int, mixed> $street

$street

The street address. If the street address is multiple lines, then pass an array of lines (up to 3).

public array<string|int, mixed> $street

Methods

__construct()

Address Type constructor. This object is used in the AddressService methods as the $params object that gets passed in.

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

jsonSerialize()

Returns an array that can be easily JsonSerialized using `json_encode()` which will yield a JSON string representation of the `Address` Type.

public jsonSerialize() : mixed

Output Example: { "name": "ShipEngine", "phone": "123465798", "company": "ShipEngine", "street": [ "4 Jersey St", "ste 200" ], "cityLocality": "Boston", "stateProvince": "MA", "postalCode": "02215", "countryCode": "US" }

Return values
mixed

validateInput()

Assertions to validate that the address array items are in the type/format we need them to be.

public validateInput(array<string|int, mixed> $address) : void
Parameters
$address : array<string|int, mixed>
Return values
void

Search results