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

ActiveLibrary[API Development](/categories/api)

namidad/laravel-usps
====================

johnpaulmedina USPS API for Laravel 8

7.0.2(5y ago)066MITPHPPHP ^7.2.5

Since Mar 29Pushed 4y agoCompare

[ Source](https://github.com/namidad/laravel-usps)[ Packagist](https://packagist.org/packages/namidad/laravel-usps)[ Docs](https://github.com/johnpaulmedina/laravel-usps/)[ RSS](/packages/namidad-laravel-usps/feed)WikiDiscussions master Synced 1mo ago

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

Laravel-USPS
============

[](#laravel-usps)

Laravel-USPS is a composer package that allows you to integrate the USPS Address / Shipping API. This package is ported from @author Vincent Gabriel

- Requires a valid USPS API Username
- Tested on Laravel 7

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

[](#installation)

Begin by installing this package through Composer. Run this command from the Terminal:

```
composer require johnpaulmedina/laravel-usps
```

Laravel integration
-------------------

[](#laravel-integration)

For Laravel 5.5 and later, this package will be auto discovered and registered.

To wire this up in your Laravel 5.4 project you need to add the service provider. Open `config/app.php`, and add a new item to the providers array.

```
Johnpaulmedina\Usps\UspsServiceProvider::class,
```

Then you must also specify the alias in `config/app.php`. Add a new item to the Aliases array.

```
'Usps' => Johnpaulmedina\Usps\Facades\Usps::class,
```

This will allow integration by adding the Facade `Use Usps;`

Laravel Config
--------------

[](#laravel-config)

Add your USPS username config in `config/services.php`.

```
'usps' => [
		'username' => "XXXXXXXXXXXX",
		'testmode' => false,
	],
```

Example Controller Usage
------------------------

[](#example-controller-usage)

The only method completed for Laravel is the `Usps::validate` which is defined in `vendor/johnpaulmedina/laravel-usps/src/Usps/Usps.php`. As this package was developed for internal use I did not bring over all the features but you are more than welcome to contribute the methods you need and I will merge them. I suggest looking at the original PHP-Wrapper by @VinceG [USPS PHP-Api](https://github.com/VinceG/USPS-php-api "USPS PHP-Api by VinceG") as I ported those clases and autoloaded them to use in the `Usps.php` file.

```
