PHPackages                             abantecart/ups-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. abantecart/ups-php

ActiveLibrary[HTTP &amp; Networking](/categories/http)

abantecart/ups-php
==================

UPS PHP SDK based on OAuth

1.1.0(1y ago)1820.4k↓41.2%10[1 PRs](https://github.com/abantecart/ups-php/pulls)MITPHPPHP ^8.2

Since Oct 12Pushed 2mo ago6 watchersCompare

[ Source](https://github.com/abantecart/ups-php)[ Packagist](https://packagist.org/packages/abantecart/ups-php)[ Docs](https://www.abantecart.com)[ RSS](/packages/abantecart-ups-php/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (5)Versions (10)Used By (0)

PHP SDK to UPS RESTful API
==========================

[](#php-sdk-to-ups-restful-api)

The UPS PHP SDK provides convenient access to the UPS RESTful API from applications written in the PHP language. It includes a batch of sets of classes for API resources that initialize themselves dynamically from API responses which makes it compatible with a wide range of versions of the UPS API. This SDK based on [official UPS API Documentation Repository](https://github.com/UPS-API/api-documentation)and generated with [Swagger-Codegen Tool](https://swagger.io/tools/swagger-codegen/)

Requirements
------------

[](#requirements)

PHP 7.4 and later.

Composer
--------

[](#composer)

You can install the bindings via [Composer](http://getcomposer.org/). To install all supported APIs run the following command:

```
composer require abantecart/ups-php
```

If you prefer to install not all APIs you should to run this command inside selected API directory.

To use the bindings, use Composer's [autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading):

```
require_once 'vendor/autoload.php';
```

Dependencies
------------

[](#dependencies)

The bindings require the following extensions in order to work properly:

- [`guzzle`](https://github.com/guzzle/guzzle)
- [`curl`](https://secure.php.net/manual/en/book.curl.php)
- [`json`](https://secure.php.net/manual/en/book.json.php)
- [`mbstring`](https://secure.php.net/manual/en/book.mbstring.php) (Multibyte String)

If you use Composer, these dependencies should be handled automatically.

Getting Started
---------------

[](#getting-started)

Generate Access Token:

```
//YOUR ACCOUNT NUMBER (6 characters)
$accNumber = '******';
//UPS API Credentials (obtain after APP creation)
$clientId = '***YOUR_UPS_API_CLIENT_ID***';
$password = '***YOUR_UPS_API_PASSWORD***';

$config = \UPS\OAuthClientCredentials\Configuration::getDefaultConfiguration()
    ->setUsername($clientId)
    ->setPassword($password)
    ->setHost('https://wwwcie.ups.com');

$apiInstance = new \UPS\OAuthClientCredentials\Request\OAuthClientCredentialsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
    new \GuzzleHttp\Client(),
    $config
);
$grant_type = "client_credentials"; // string |
$x_merchant_id = $accNumber; // string | Client merchant ID

try {
    $result = $apiInstance->createToken($grant_type, $x_merchant_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->generateToken: ', $e->getMessage(), PHP_EOL;
}
```

Rating request:

```
// Configure OAuth2 access token for authorization: oauth2
$config = UPS\Rating\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new UPS\Rating\Request\RatingApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$body = new \UPS\Rating\Rating\RATERequestWrapper(); // \UPS\Rating\Rating\RATERequestWrapper | Generate sample code for popular API requests by selecting an example below. To view a full sample request and response, first click "Authorize" and enter your application credentials, then populate the required parameters above and click "Try it out".
$version = "v1"; // string | Indicates Rate API to display the new release features in Rate API response based on Rate release. See the New section for the latest Rate release. Supported values: v1, v1601, v1607, v1701, v1707, v2108, v2205. Length 5
$requestoption = "Shop"; // string | Valid Values: Rate = The server rates (The default Request option is Rate if a Request Option is not provided). Shop = The server validates the shipment, and returns rates for all UPS products from the ShipFrom to the ShipTo addresses. Rate is the only valid request option for Ground Freight Pricing requests. . Length 10
$trans_id = "trans_id_example"; // string | An identifier unique to the request. Length 32
$transaction_src = "testing"; // string | An identifier of the client/source application that is making the request.Length 512
$additionalinfo = ""; // string | Valid Values: timeintransit = The server rates with transit time information combined with requestoption in URL.Rate is the only valid request option for Ground Freight Pricing requests. Length 15

try {
    $result = $apiInstance->rate($body, $version, $requestoption, $trans_id, $transaction_src, $additionalinfo);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->rate: ', $e->getMessage(), PHP_EOL;
}
```

More examples see in the \_examples directory. Shipment creation and getting labels code available inside AbanteCart "UPS" extension since v1.4.3

Documentation
-------------

[](#documentation)

See the [UPS API docs](https://developer.ups.com/catalog?loc=en_US).

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance70

Regular maintenance activity

Popularity39

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 95.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~80 days

Recently: every ~150 days

Total

9

Last Release

396d ago

PHP version history (2 changes)v1.0.0PHP ^7.4 || ^8.0

1.1.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/d6fef2e4daaaa206b3d9a1a3d986a829386816047f582b404d47be19bfd38212?d=identicon)[abolabo](/maintainers/abolabo)

---

Top Contributors

[![abolabo](https://avatars.githubusercontent.com/u/1264239?v=4)](https://github.com/abolabo "abolabo (23 commits)")[![abantecart](https://avatars.githubusercontent.com/u/1239995?v=4)](https://github.com/abantecart "abantecart (1 commits)")

---

Tags

phpapisdkrestweb serviceoauthupsshipping processing

### Embed Badge

![Health badge](/badges/abantecart-ups-php/health.svg)

```
[![Health](https://phpackages.com/badges/abantecart-ups-php/health.svg)](https://phpackages.com/packages/abantecart-ups-php)
```

###  Alternatives

[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

353.6k](/packages/eslazarev-wildberries-sdk)[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.2k555.0M2.8k](/packages/aws-aws-sdk-php)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k6.0M777](/packages/sylius-sylius)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.8M674](/packages/shopware-core)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[onesignal/onesignal-php-api

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com

37234.5k4](/packages/onesignal-onesignal-php-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
