chrishardie/laravel-usps-addresses
最新稳定版本:v0.1.1
Composer 安装命令:
composer require chrishardie/laravel-usps-addresses
包简介
Laravel package that provides a simple facade to the USPS Addresses API
README 文档
README
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.
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-08