Open-Source PHP Framework - Designed for rapid development of performance-oriented scalable applications

Shipping component

API >> mvc >> components >> shipping

The shipping component contains shipping-related tools.

Shipping company abbreviations

contains an array of shipping companies with keys of their common abbreviation and values of their full name eg.:

would return Federal Express.

Track a package

The contains an array of URLs (one from each company in the shippingCompanies array above) that you can simply append a tracking number to and it will show the tracking information. Common usage would be:

Get live shipping rates from UPS

The method will return an array of available UPS shipping rates. All keys in are optional, but you do need to supply some of them in order to get a meaningful response from UPS. Options are:

  • (the 2-digit country code)
  • (the 2-digit country code)
  • (in lbs.)
  • (as defined by UPS)
  • (as defined by UPS)
  • (as defined by UPS)
  • (as defined by UPS)

Return will either give you the array keys and or it will have an array key for . If it is then the value will be a string describing the error. The and are both arrays indexed by service code (defined in the next section about property.) In many cases you will only need which contains an array of human-readable shipping options. contains the full UPS response info as an array. Each service code in gets a subarray with keys:

  • - the human-readable value that corresponds to the service code
  • - the data as returned by UPS for this option in a SimpleXML object

The and options may not be available for every ship method in which case it will return an empty string.

Note that this does connect to the UPS service which requires you to initially create an account and set the credentials in the .config. Also, there is typically a noticeable lag getting a response from the UPS service.

Typical usage:

UPS shipping methods

The array maps the UPS shipping method code to the human-readable name, eg.:

is 2nd Day Air AM