PHPackages                             mmediasoftwarelab/usps-oauth-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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. mmediasoftwarelab/usps-oauth-php

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

mmediasoftwarelab/usps-oauth-php
================================

Modern PHP library for USPS OAuth 2.0 API - Shipping rates, labels, and tracking for the 2026+ API

1.0.0(4mo ago)00MITPHPPHP ^8.1CI passing

Since Jan 11Pushed 4mo agoCompare

[ Source](https://github.com/mmediasoftwarelab/usps-oauth-php)[ Packagist](https://packagist.org/packages/mmediasoftwarelab/usps-oauth-php)[ Docs](https://github.com/mmediasoftwarelab/usps-oauth-php)[ RSS](/packages/mmediasoftwarelab-usps-oauth-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

USPS OAuth PHP Library
======================

[](#usps-oauth-php-library)

[![Latest Version](https://camo.githubusercontent.com/d53fd658ffd560f646bb1fee2f7310c563c64339be45cb1c60c633fb6c8874ee/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6d65646961736f6674776172656c61622f757370732d6f617574682d7068702e737667)](https://packagist.org/packages/mmediasoftwarelab/usps-oauth-php)[![PHP Version](https://camo.githubusercontent.com/8da407d2db5bc82bd3de86303d42ee8c2833f5ea5276174f34584ce859246932/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6d6d65646961736f6674776172656c61622f757370732d6f617574682d7068702e737667)](https://packagist.org/packages/mmediasoftwarelab/usps-oauth-php)[![License](https://camo.githubusercontent.com/2632441ec17b363646d19469e8acefd459f98eadeeefef400edc87b81bda7254/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d6d65646961736f6674776172656c61622f757370732d6f617574682d7068702e737667)](https://packagist.org/packages/mmediasoftwarelab/usps-oauth-php)[![Tests](https://github.com/mmediasoftwarelab/usps-oauth-php/workflows/CI/badge.svg)](https://github.com/mmediasoftwarelab/usps-oauth-php/actions)[![Coverage](https://camo.githubusercontent.com/434530db2d5a139e824793d41d4bf566223cc871b3abfdf1a24558457462eba0/68747470733a2f2f636f6465636f762e696f2f67682f6d6d65646961736f6674776172656c61622f757370732d6f617574682d7068702f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/mmediasoftwarelab/usps-oauth-php)

Modern PHP library for the USPS OAuth 2.0 API (2026+). Get real-time shipping rates, generate labels, and track packages using the latest USPS Web Tools API v3.

**Why this library?**

- ✅ **OAuth 2.0** - Uses the new USPS API (2026+ ready)
- ✅ **Modern PHP** - PHP 8.1+ with type safety
- ✅ **Framework Agnostic** - Works with any PHP project
- ✅ **PSR Compatible** - PSR-4 autoloading, PSR-3 logging
- ✅ **Well Tested** - Comprehensive unit tests
- ✅ **Production Ready** - Used in commercial applications

Installation
------------

[](#installation)

```
composer require mmediasoftwarelab/usps-oauth-php
```

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

[](#requirements)

- PHP 8.1 or higher
- ext-json
- ext-curl
- ext-openssl (for HTTPS requests)
- ext-mbstring (recommended)
- Valid USPS Business Account with API credentials

### Getting USPS API Credentials

[](#getting-usps-api-credentials)

1. Create a USPS Business Account at [USPS.com](https://reg.usps.com/entreg/RegistrationAction_input)
2. Request API access through the [USPS Web Tools portal](https://www.usps.com/business/web-tools-apis/)
3. You'll receive a Client ID and Client Secret for OAuth authentication

### Environment Setup

[](#environment-setup)

For development and testing, create a `.env` file:

```
cp .env.example .env
```

Add your credentials:

```
USPS_CLIENT_ID=your-client-id-here
USPS_CLIENT_SECRET=your-client-secret-here
USPS_SANDBOX=true
```

**Note**: Never commit `.env` to version control. It's already in `.gitignore`.

Quick Start
-----------

[](#quick-start)

```
