PHPackages                             bedard/shipping - 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. bedard/shipping

AbandonedArchivedLibrary[API Development](/categories/api)

bedard/shipping
===============

API wrapper for shipping calculations.

21111PHP

Since Jan 9Pushed 11y ago1 watchersCompare

[ Source](https://github.com/scottbedard/shipping)[ Packagist](https://packagist.org/packages/bedard/shipping)[ RSS](/packages/bedard-shipping/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

USPS Shipping Calculator
========================

[](#usps-shipping-calculator)

[![Build Status](https://camo.githubusercontent.com/b7cd63f80df9f2afcbd79e1c54b540bca83c1bb04f7187b0f397d04a1aac70bd/68747470733a2f2f7472617669732d63692e6f72672f73636f74746265646172642f7368697070696e672e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/scottbedard/shipping)[![Coverage Status](https://camo.githubusercontent.com/66a888fe053e022a3f6d2ebc6dc09d379cfedc5a00ead29951dbdb678dc7632f/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f73636f74746265646172642f7368697070696e672f62616467652e706e673f6272616e63683d6d6173746572)](https://coveralls.io/r/scottbedard/shipping?branch=master)

A simple PHP wrapper for USPS shipping calulations.

### Instructions

[](#instructions)

The first step to requesting a shipping quote is injecting your USPS Web Tools ID.

```
use Bedard\Shipping\Usps;
$shipment = new Usps('123ABCDE4567');
```

If you would like to run the calculator on the USPS testing server, call `useTestingServer()`.

```
$shipment->useTestingServer();
```

Once this is done, it's time to build up the data you'll be sending to USPS. Length, width, and height are all specified in inches. Pounds, ounces, and setValue() are all optional.

```
$rates = $shipment
    ->setOrigin('12345')
    ->setDestination('90210')
    ->setDimensions([
        'length'    => 12,
        'width'     => 12,
        'height'    => 4,
        'pounds'    => 0,
        'ounces'    => 1
    ])
    ->setValue(49.99)
    ->calculate();
```

The above is an example of a domestic shipment. To request an international rate, simply pass the destination country into `setDestination()` instead of a postal code.

```
$shipment->setDestination('Canada');
```

Once you've called `calculate()`, shipping rates will be returned in the following format. Results will be ordered by cost in ascending order.

```
 1 =>
    array (size=3)
      'code' => string '01' (length=2)
      'name' => string 'First-Class Mail Large Envelope' (length=31)
      'cost' => float 0.98
  2 =>
    array (size=3)
      'code' => string '00' (length=2)
      'name' => string 'First-Class Mail Parcel' (length=23)
      'cost' => float 2.32
  3 =>
    array (size=3)
      'code' => string '1' (length=1)
      'name' => string 'Priority Mail 2-Day' (length=19)
      'cost' => float 5.75

```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/904cc72c102eb3725fdc5191aaf7519724839af6feb847dc20dfa138f37e50b2?d=identicon)[scottbedard](/maintainers/scottbedard)

---

Top Contributors

[![scottbedard](https://avatars.githubusercontent.com/u/7980426?v=4)](https://github.com/scottbedard "scottbedard (10 commits)")

### Embed Badge

![Health badge](/badges/bedard-shipping/health.svg)

```
[![Health](https://phpackages.com/badges/bedard-shipping/health.svg)](https://phpackages.com/packages/bedard-shipping)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k13](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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