Download the PHP package jstewmc/usps-address without Composer

On this page you can find all versions of the php package jstewmc/usps-address. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package usps-address

CircleCI codecov

USPS Address

A library for normalizing and comparing United States Postal Service (USPS) addresses in PHP.

Comparing addresses is tricky. There are many different ways to represent the same physical address. For example, "123 First St" is the same address as "123 1st St". However, to a computer, those are two different things.

This library attempts to normalize addresses so that different forms of the same physical address can be compared. For example, "17 First Street" and "17 1st st" will be considered equal.

There are a few caveats:

  1. A normalized address should not be displayed to users. It's formatted to help a computer compare addresses for equality, and it's not "pretty".
  2. A normalized address should not be saved over the original address. The normalized version of an address may change as this library's algorithm improves, but once you overwrite the original address, it's gone forever.
  3. A normalized address should not be considered authentic. This library will normalize and compare whatever address you give it, regardless of whether or not it actually exists. If you don't mind using a web service, there are APIs available that can normalize, validate, and authenticate addresses for you.

Installation

This library requires PHP 7.4+.

It is multi-platform, and we strive to make it run equally well on Windows, Linux, and OSX.

It should be installed via Composer. To do so, add the following line to the require section of your composer.json file, and run composer update:

Usage

This library defines an interface for USPS addresses, AddressInterface, which supports a two-line street address, a city, a state, and a zip code, for example:

All components are optional to support partial data.

This library provides an implementation of the interface, Address, as well as a trait, Addressable, which you can use in your own classes to implement the interface.

Using your implementation

When using your implementation of AddressInterface (let's call it MyAddress), you can use this library's Compare service to compare addresses:

If you'd like to access a lower-level normalized address, you can use the Normalize service to do so. Keep in mind, this service will accept any implementation of the AddressInterface, and it will return an instance of our own implementation, Address:

If you're using both services, you can inject your instance of the Normalize service into your instance of the Compare service. Otherwise, the Compare service will instantiate its own copy of the Normalize service:

Using our implementation

Our implementation of AddressInterface, Address, provides two methods - equals() and normalize() - for convenience. These methods are reasonable shortcuts to managing the services if you aren't processing a large number of addresses. With large enough datasets, the methods' instantiating and discarding single-use objects may affect memory and performance.

Our implementation also allows you to instantiate an address using the constructor alone:

Migrating from 0.1

This library changed substantially from 0.1 to 0.2:

  1. We moved previously public static properties to private constants to better encapsulate them.
  2. We moved previously public static methods to a service for a service-friendly, easier-to-test solution.
  3. We programmed to an interface, not an implementation, and provided a trait to make the library easier to use with your own code.
  4. We removed the Usps prefix from class names, because it didn't add information not already obvious from the library's name.

As a result, migrating from 0.1 to 0.2 involves a number of breaking changes. Although painful, we believe it will make the library easier to use and maintain in the future.

Contributing

Contributions are welcome!

License

This library is released under the MIT License.


All versions of usps-address with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
jstewmc/php-helpers Version ^0.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jstewmc/usps-address contains the following files

Loading the files please wait ....