chrishardie/laravel-usps-addresses 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

chrishardie/laravel-usps-addresses

Composer 安装命令:

composer require chrishardie/laravel-usps-addresses

包简介

Laravel package that provides a simple facade to the USPS Addresses API

README 文档

README

Latest Version on Packagist Total Downloads

Laravel package that provides a simple facade to the USPS Addresses API

Installation

You can install the package via composer:

composer require chrishardie/laravel-usps-addresses

Define required variables in .env, available from your app's configuration in the USPS Developers Dashboard:

USPS_CLIENT_ID=
USPS_CLIENT_SECRET=

You can optionally publish the config file with:

php artisan vendor:publish --tag="laravel-usps-addresses-config"

This is the contents of the published config file:

return [
    'base_url' => env('USPS_ADDRESSES_BASE_URL', 'https://apis.usps.com/addresses/v3'),

    'oauth' => [
        'token_url' => env('USPS_OAUTH_TOKEN_URL', 'https://apis.usps.com/oauth2/v3/token'),
        'client_id' => env('USPS_CLIENT_ID'),
        'client_secret' => env('USPS_CLIENT_SECRET'),
        'scope' => 'addresses',
    ],

    'timeout' => 10,
];

Usage

use UspsAddress;

$result = UspsAddress::verify([
    'streetAddress' => '2704 Erie Ave',
    'city' => 'Cincinnati',
    'state' => 'OH',
]);

if ($result->isValid()) {
    echo $result->address->streetAddress;
};

Methods available correspond to available API endpoints:

  • UspsAddress::verify(): Returns the best standardized address for a given address.
  • UspsAddress::cityState(): Returns the city and state for a given ZIP Code.
  • UspsAddress::zipCode(): Returns the ZIP Code for a given address.

View the USPS API documentation for details about available parameters and responses.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 850
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固