Download the PHP package besmartand-pro/ups-api without Composer

On this page you can find all versions of the php package besmartand-pro/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

UPS REST PHP SDK

A PHP SDK for the UPS REST API, brought to you by ShipStream.

Installation

Note: The latest version is compatible only with PHP 8.x. For PHP 7.4 support, please append the ^1.0 version constraint to the above command.

Basic Usage

Create a UPS Client instance using a configuration object:

The Client object contains methods for every endpoint available in the UPS OpenAPI definition files with PHPDoc comments that describe the parameters and return types, as well as any thrown exceptions. Method names for each endpoint is based on the operationId property of the OpenAPI specification.

Here's an example using the Tracking API:

Authentication

Client Credentials

Using Client Credentials flow works out of the box and requires no additional steps as the access token generation and refresh is handled internally.

Authorization Code

To start using the Authorization Code flow set grant_type config to Config::GRANT_TYPE_AUTHORIZATION_CODE, then call the authorizeClient endpoint and redirect the user to the returned login URL:

The user will be redirected back to your app after login with the authorization code that will be used to generate an access token:

The access token refresh will be handled internally so long that the refresh token is still valid. You can check if the client is authenticated at any time by calling $client->getAccessToken() which attempts to retrieve the access token from the cache and refresh it if it has already expired, otherwise it throws an AuthenticationException.

Caching Access Tokens

The library uses an in-memory cache for access tokens by default which is useful when doing quick tests, but for a production environment you'd want to use something like Redis or a filesystem cache to avoid doing round trips to generate an access token on every request. To achieve this, the Client factory accepts a second parameter which can be any object that implements the AccessTokenCache interface. For example, a Redis implementation could look like this:

Using a custom HTTP Client

If you wish to customize how HTTP requests are made, perhaps for logging or to add additional headers, the Client factory supports a third parameter that can be any HTTP Client that implements the PSR-18 standard. E.g.:

Note that the HTTP Client must not throw exceptions for 4xx and 5xx responses, as those should be handled by the SDK.

Development

The classes under the ShipStream\Ups\Api namespace are all generated using janephp.

Run the generate.sh script to regenerate the classes when needed.


All versions of ups-api with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
ext-curl Version *
ext-json Version *
jane-php/open-api-runtime Version ^7.6
php-http/curl-client Version ^2.3
symfony/polyfill-php81 Version ^1.28
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 besmartand-pro/ups-api contains the following files

Loading the files please wait ....