PHPackages                             bkuhl/simple-ups - 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. [API Development](/categories/api)
4. /
5. bkuhl/simple-ups

ActiveLibrary[API Development](/categories/api)

bkuhl/simple-ups
================

Fetch rates, track packages and verify addresses via the UPS API

1.0(11y ago)1520.8k↓91.3%10[1 issues](https://github.com/bkuhl/simple-ups/issues)[1 PRs](https://github.com/bkuhl/simple-ups/pulls)MITPHPPHP &gt;=5.3.2

Since Apr 19Pushed 10y ago5 watchersCompare

[ Source](https://github.com/bkuhl/simple-ups)[ Packagist](https://packagist.org/packages/bkuhl/simple-ups)[ RSS](/packages/bkuhl-simple-ups/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)DependenciesVersions (3)Used By (0)

SimpleUPS
=========

[](#simpleups)

An easy to use PHP UPS Library for tracking, rates and address validation

[![Total Downloads](https://camo.githubusercontent.com/2061309021600648ba75f47bad91ddb447a88c55a88b76f32fb1735233b9a63f/68747470733a2f2f706f7365722e707567782e6f72672f626b75686c2f73696d706c652d7570732f646f776e6c6f6164732e737667)](https://packagist.org/packages/bkuhl/simple-ups) [![License](https://camo.githubusercontent.com/88fa723ffbe0f0466b3f3ed65e918c6d2695f4801b13af3273e5679a645e43f4/68747470733a2f2f706f7365722e707567782e6f72672f626b75686c2f73696d706c652d7570732f6c6963656e73652e737667)](https://packagist.org/packages/bkuhl/simple-ups) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/0f9d9f7cb3f62265be2b3035f0bcfc48527ec75146b9e7575aea9ca54b120fc3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f626b75686c2f73696d706c652d7570732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/bkuhl/simple-ups/?branch=master)

README Contents
---------------

[](#readme-contents)

- [Features](#features)
- [Installation](#installation)
- [Requirements](#requirements)
- [Usage](#usage)
    - [Address Validation](#address-validation)
    - [Region Validation](#region-validation)
    - [Tracking Shipments](#tracking-shiments)
    - [Fetching Rates](#fetching-rates)

\## Features - **Address Validation** - Ensure an address is valid before it's accepted by your application
- **Address Correction** - If an address is invalid, we'll help you correct it
- **Track Packages** - See current status, recent activity, delivery requirements (signature, etc.), insurance details and more
- **Shipping Rates** - Get shipping estimates for packages

\## Installation You can install the library via [Composer](http://getcomposer.org) by running:

```
composer require bkuhl/simple-ups:1.*

```

> 1.\* versions will maintain PHP 5.3 compatibility. `dev-master` will increase the PHP version requirement for future, 2.\* versions.

\## Usage SimpleUPS is currently only available in a static context with the following methods:

- SimpleUPS::getRates()
- SimpleUPS::isValidRegion()
- SimpleUPS::getSuggestedRegions()
- SimpleUPS::trackByTrackingNumber()
- SimpleUPS::isValidAddress()
- SimpleUPS::getCorrectedAddress()
- SimpleUPS::getSuggestedAddresses()
- SimpleUPS::setAuthentication()
- SimpleUPS::getAccountNumber()
- SimpleUPS::getAccessLicenseNumber()
- SimpleUPS::getPassword()
- SimpleUPS::getUserId()
- SimpleUPS::setShipper()
- SimpleUPS::getShipper()
- SimpleUPS::setCurrencyCode()
- SimpleUPS::setDebug()
- SimpleUPS::getDebugOutput()

\### Address Validation Validating an address can be useful to ensure an address that a user provides can be shipped to.

```
$address = new Address();
$address->setStreet('1001 North Alameda Street');
$address->setStateProvinceCode('CA');
$address->setCity('Los Angeles');
$address->setPostalCode(90012);
$address->setCountryCode('US');

try {
    var_dump(UPS::isValidAddress($address)); // true
} catch(Exception $e) {
    //unable to validate address
}
```

\### Region Validation If an address fails, validating the region can help you determine if the city, state and zip is valid even if the street address isn't.

```
$address = new Address();
$address->setStreet('xx North Alameda Street');
$address->setStateProvinceCode('CA');
$address->setCity('Los Angeles');
$address->setPostalCode(90012);
$address->setCountryCode('US');

try {
    if (!UPS::isValidAddress($address))
        var_dump(UPS::isValidRegion($address)); // true
} catch(Exception $e) {
    //unable to validate region or address
}
```

\### Tracking Shipments Tracking numbers may contain multiple shipments, and shipments may contain multiple packages, and activity is associated with packages.

```
try {
    /* @var $shipment \SimpleUPS\Track\SmallPackage\Shipment */
    foreach (UPS::trackByTrackingNumber('1Z4861WWE194914215') as $shipment)
        foreach ($shipment->getPackages() as $package)
            foreach ($package->getActivity() as $activity)
                if ($activity->getStatusType()->isDelivered())
                    echo 'DELIVERED';
} catch (TrackingNumberNotFoundException $e) {
    //Tracking number does not exist
} catch (Exception $e) {
    //Unable to track package
}

var_dump(UPS::isValidAddress($address)); // false
```

\### Fetching Rates ```
try {
    //set shipper
    $fromAddress = new \SimpleUPS\InstructionalAddress();
    $fromAddress->setAddressee('Mark Stevens');
    $fromAddress->setStreet('10571 Pico Blvd');
    $fromAddress->setStateProvinceCode('CA');
    $fromAddress->setCity('Los Angeles');
    $fromAddress->setPostalCode(90064);
    $fromAddress->setCountryCode('US');

    $shipper = new \SimpleUPS\Shipper();
    $shipper->setNumber('xxxxxxx');
    $shipper->setAddress($fromAddress);

    UPS::setShipper($shipper);

    //define a shipping destination
    $shippingDestination = new \SimpleUPS\InstructionalAddress();
    $shippingDestination->setStreet('220 Bowery');
    $shippingDestination->setStateProvinceCode('NY');
    $shippingDestination->setCity('New York');
    $shippingDestination->setPostalCode(10453);
    $shippingDestination->setCountryCode('US');

    //define a package, we could specify the dimensions of the box if we wanted a more accurate estimate
    $package = new \SimpleUPS\Rates\Package();
    $package->setWeight('7');

    $shipment = new \SimpleUPS\Rates\Shipment();
    $shipment->setDestination($shippingDestination);
    $shipment->addPackage($package);

    echo 'Rates: ';

    echo '';
        foreach (UPS::getRates($shipment) as $shippingMethod)
            echo ''.$shippingMethod->getService()->getDescription().' ($'.$shippingMethod->getTotalCharges().')';

    echo '';

} catch (Exception $e) {
    //doh, something went wrong
    echo 'Failed: ('.get_class($e).') '.$e->getMessage().'';
    echo 'Stack trace:'.$e->getTraceAsString().'';
}
```

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% 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 ~409 days

Total

2

Last Release

3684d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/524933?v=4)[Ben Kuhl](/maintainers/bkuhl)[@bkuhl](https://github.com/bkuhl)

---

Top Contributors

[![bkuhl](https://avatars.githubusercontent.com/u/524933?v=4)](https://github.com/bkuhl "bkuhl (15 commits)")[![Richtermeister](https://avatars.githubusercontent.com/u/624921?v=4)](https://github.com/Richtermeister "Richtermeister (3 commits)")[![bullder](https://avatars.githubusercontent.com/u/353955?v=4)](https://github.com/bullder "bullder (2 commits)")

---

Tags

ups

### Embed Badge

![Health badge](/badges/bkuhl-simple-ups/health.svg)

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

###  Alternatives

[gabrielbull/ups-api

PHP UPS API

4572.4M11](/packages/gabrielbull-ups-api)[shippo/shippo-php

A PHP library for connecting with multiple carriers (FedEx, UPS, USPS) using Shippo.

1681.9M2](/packages/shippo-shippo-php)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[gavroche/ups-api

PHP UPS API

45813.4k](/packages/gavroche-ups-api)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[pdt256/shipping

Shipping Rate API

1814.9k](/packages/pdt256-shipping)

PHPackages © 2026

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