Download the PHP package gabrielbull/ups-api without Composer

On this page you can find all versions of the php package gabrielbull/ups-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ups-api

PHP UPS API

CI StyleCI Scrutinizer Code Quality Code Coverage Code Climate Latest Stable Version Total Downloads License Join the chat at https://gitter.im/gabrielbull/php-ups-api

This library wrap all the UPS API into a simple to use PHP Library. It currently covers the Quantum View®, Tracking API, Shipping API, Rating API and Time in Transit API. Feel free to contribute.

Table Of Content

  1. Requirements
  2. Installation
  3. Address Validation Class
    • Example
    • Parameters
  4. Simple Address Validation Class
    • Example
    • Parameters
  5. QuantumView Class
    • Example
    • Parameters
  6. Tracking Class
    • Example
    • Parameters
  7. Rate Class
    • Example
    • Parameters
  8. RateTimeInTransit Class
    • Example
    • Parameters
  9. TimeInTransit Class
    • Example
    • Parameters
  10. Locator Class
    • Example
    • Parameters
  11. Tradeability Class
    • Example
    • Parameters
  12. Shipping Class
    • Example
    • Parameters
  13. Shipment Service Options
    • Example
  14. Logging
  15. License

Requirements

This library uses PHP 7.1+.

To use the UPS API, you have to request an access key from UPS. For every request, you will have to provide the Access Key, your UPS User ID and Password.

Installation

It is recommended that you install the PHP UPS API library through composer. To do so, run the Composer command to install the latest stable version of PHP UPS API:

If not using composer, you must also include these libraries: Guzzle, Guzzle Promises, [Guzzle PSR7] (https://github.com/guzzle/psr7), PHP-Fig PSR Log, and PHP-Fig HTTP Message.

Address Validation Class (Street Level)

The Address Validation Class allow you to validate an address at street level. Suggestions are given when address is invalid.

Note: UPS has two Address Validations. This is Street Level option, which includes all option of the normal Address Validation class and adds street level validation.

Currently, only US & Puerto Rico are supported.

Example

AddressValidation::validateReturnAVObject()

In the code above $xav->activateReturnObjectOnValidate() is completely optional. Calling this method will cause AddressValidation::validate() to return an AddressValidationResponse object. If you do not call this method, validate continues to function as it has previously. If you do not call this method, a single object with either the matched validated address, or the first candidate address if the address is ambiguous, will be returned.

The AddressValidationResponse object provides a number of methods to allow you to more easily query the API response to determine the outcome. Continuing the example from above, returning an AddressValidationResponse object will allow you to be a bit more specific with how you handle the various outcomes:

Parameters

Address Validation parameters are:

Simple Address Validation Class

The Simple Address Validation Class allow you to validate less extensive as the previous class. It returns a quality score of the supplied address and provides alternatives.

Note: UPS has two Address Validations. This is the Simple option.

Currently, only US & Puerto Rico are supported.

Example

Parameters

Simple Address Validation parameters are:

QuantumView Class

The QuantumView Class allow you to request a Quantum View Data subscription.

Example

Parameters

QuantumView parameters are:

If you provide a beginDateTime, but no endDateTime, the endDateTime will default to the current date time.

To use the fileName parameter, do not provide a beginDateTime.

Tracking Class

The Tracking Class allow you to track a shipment using the UPS Tracking API.

Example using Tracking Number / Mail Innovations tracking number

Parameters

Tracking parameters are:

Example using Reference Number

Parameters

Tracking parameters are:

Example using Reference Number with additional parameters

The parameters shipperNumber, beginDate and endDate are optional. Either of the parameters can be set individually. These parameters can help to narrow the search field when tracking by reference, since it might happen that the reference number used is not unique. When using tracking by tracking number these parameters are not needed since the tracking number is unique.

Rate Class

The Rate Class allow you to get shipment rates using the UPS Rate API.

Example

Parameters

This Rate class is not finished yet! Parameter should be added when it will be finished.

RateTimeInTransit Class

The RateTimeInTransit Class allow you to get shipment rates like the Rate Class, but the response will also include TimeInTransit data.

Example

Parameters

This RateTimeInTransit extends the Rate class which is not finished yet! Parameter should be added when it will be finished.

TimeInTransit Class

The TimeInTransit Class allow you to get all transit times using the UPS TimeInTransit API.

Example

Parameters

Locator Class

The Locator class allows you to search for UPS Access Point locations.

Example

Parameters

Locator class parameters are:

Tradeability Class

The Tradeability class allows you to get data for international shipments:

Note: only the Landed Costs API is currently implemented.

⚠️ Tradeability is only available through a SOAP API. Therefore you are required to have the SOAP extension installed on your system.

Example

Parameters

For the Landed Cost call, parameters are:

Shipping Class

The Shipping class allows you to register shipments. This also includes return shipments.

The shipping flow consists of 2 steps:

Please note this is just an example. Your use case might demand more or less information to be sent to UPS.

In the example $return is used to show how a return could be handled.

Example

If you wanted to create a printable file from the UPS Shipping label image data that came back with $accept, you would use something like the following:

Parameters

For the Shipping confirm call, the parameters are:

For the Shipping accept call, the parameters are:

Shipment Service Options

The Shipment Service Options class allows you to register shipments additional options. This also includes.

In the example ShipmentServiceOptions class is used to show how a Shipment Additional Option can be added to Shipment.

Shipment Service Options Example

Logging

All constructors take a PSR-3 compatible logger.

Besides that, the main UPS class has a public method setLogger to set it after the constructor ran.

Requests & responses (including XML, no access keys) are logged at DEBUG level. At INFO level only the event is reported, not the XML content. More severe problems (e.g. no connection) are logged with higher severity.

Example using Monolog

``

License

PHP UPS API is licensed under The MIT License (MIT).


All versions of ups-api with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3 || ^8.0
ext-dom Version *
ext-simplexml Version *
guzzlehttp/guzzle Version ^6.0 || ^7.0
psr/log Version ^1.0 || ^2.0 || ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package gabrielbull/ups-api contains the following files

Loading the files please wait ....