PHPackages                             ctwillie/laravel-usps - 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. ctwillie/laravel-usps

ActiveLibrary[API Development](/categories/api)

ctwillie/laravel-usps
=====================

USPS API wrapper for Laravel 6 framework

v0.1.1(6y ago)4161MITPHP

Since Nov 6Pushed 4y ago1 watchersCompare

[ Source](https://github.com/ctwillie/laravel-usps)[ Packagist](https://packagist.org/packages/ctwillie/laravel-usps)[ RSS](/packages/ctwillie-laravel-usps/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

Laravel-Usps
============

[](#laravel-usps)

This package provides a very simple wrapper for the United States Postal Service API. Currently, this package only provides address validation features, but will soon comprise all features offered by the USPS API.

### Prerequisites

[](#prerequisites)

Be sure to register at [www.usps.com/webtools/](www.usps.com/webtools/) to receive your unique user ID from the United States Postal Service. This user ID is required to use this package.

### Installation

[](#installation)

```
composer require ctwillie/laravel-usps

```

Configuration
-------------

[](#configuration)

There are three important configurations.

1. Your USPS user ID:

    - If you have not received your USPS user ID, follow the link in the [prerequisites](#Prerequisites) section to register with the United States Postal Service. It is required to use this package.
2. Whether you want SSL verification enabled for API requests:

    - This setting is set to `true` by default for security reasons. You can override this behavior by setting the `verrifyssl` config setting to `false`. Do this at your own risk.
3. Which environment you are working in:

    - The options are `'local' and 'production'` which tell the package which API url to use, testing or production respectively. If no configuration is found for `env`, it will default to the environment recognized by laravel. This setting takes precedence over `APP_ENV` from your `.env` file.

We recommend placing all configuration settings in your `.env` file and use Laravel's `env()` helper function to access these values.

In `config/services.php` add these three settings.

```
'usps' => [

    'userid' => env('USPS_USER_ID'), // string
    'verifyssl' => env('USPS_VERIFY_SSL'), // bool
    'env' => env('USPS_ENV') //string
];
```

Usage
-----

[](#usage)

The current features offered by this package are:

- [Address Validation](#Address-Validation)

Address Validation
------------------

[](#address-validation)

The `Address` class handles creating and formatting address data. Pass the constructor an associative array of address details. Array keys are case-sensitive. Below is an example of creating an address and making an api request for validation.

```
use ctwillie\Usps\Address;

$address = new Address([
    'Address2' => '6406 Ivy Lane',
    'City' => 'Greenbelt',
    'State' => 'MD',
    'Zip5' => 20770
]);

$response = $address->validate();
```

The USPS api supports up to 5 address validations per request. If you need to validate more than one address at a time, pass an array of addresses to the `Address` constructor.

```
use ctwillie\Usps\Address;

$address1 = [
    'Address2' => '6406 Ivy Lane',
    'City' => 'Greenbelt',
    'State' => 'MD',
    'Zip5' => 20770
];

$address2 = [
    'Address2' => '2185 Sandy Drive',
    'City' => 'Franklin',
    'State' => 'VA',
    'Zip5' => 32050
];

$addresses = new Address([$address1, $address2]);

$response = $addresses->validate();
```

The response will contain the [corrected address](https://www.usps.com/business/web-tools-apis/address-information-api.pdf), or an error if not enough information was given or the address does not exists.

Response Formatting
-------------------

[](#response-formatting)

You can specify the format of the response by passing an optional, case-insensitive parameter to the validate method. The default format is an associative array.

```
$address = new Address([/* address info */ ]);

$json = $address->validate('json');
$object = $address->validate('object');
$string = $address->validate('string');
```

Contributing
------------

[](#contributing)

Contributions are always welcomed and will receive full credit.

We accept contributions via Pull Requests on Github.

Authors
-------

[](#authors)

- **Cedric Twillie**

See also the list of [contributors](https://github.com/ctwillie/laravel-usps/graphs/contributors) who participated in this project.

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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.

###  Release Activity

Cadence

Every ~1 days

Total

2

Last Release

2377d ago

### Community

Maintainers

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

---

Top Contributors

[![ctwillie](https://avatars.githubusercontent.com/u/32856661?v=4)](https://github.com/ctwillie "ctwillie (42 commits)")

---

Tags

laravellaravel 6uspslaravel uspsusps apilaravel 6 usps

### Embed Badge

![Health badge](/badges/ctwillie-laravel-usps/health.svg)

```
[![Health](https://phpackages.com/badges/ctwillie-laravel-usps/health.svg)](https://phpackages.com/packages/ctwillie-laravel-usps)
```

###  Alternatives

[irazasyed/telegram-bot-sdk

The Unofficial Telegram Bot API PHP SDK

3.3k4.5M84](/packages/irazasyed-telegram-bot-sdk)[dcblogdev/laravel-microsoft-graph

A Laravel Microsoft Graph API (Office365) package

168285.5k1](/packages/dcblogdev-laravel-microsoft-graph)[vluzrmos/slack-api

Wrapper for Slack.com WEB API.

102589.1k3](/packages/vluzrmos-slack-api)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[dcblogdev/laravel-xero

A Laravel Xero package

53129.1k1](/packages/dcblogdev-laravel-xero)[simplestats-io/laravel-client

Client for SimpleStats!

4515.5k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

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