Looking to hire Laravel developers? Try LaraJobs

laravel maintained by addresszen

Description
Laravel package for the AddressZen PHP SDK: set your API key in .env, then inject the client or call the facade
Author
Last update
2026/11/26 17:32 (dev-main)
License
Downloads
0

Comments
comments powered by Disqus

AddressZen Laravel Package

Set your AddressZen API key in .env, then inject the PHP SDK client into a controller, or call the facade. Laravel 12 or 13, PHP 8.2 or later.

composer require addresszen/laravel

Package discovery registers the service provider and the AddressZen facade.

# .env
ADDRESSZEN_API_KEY=ak_test
ADDRESSZEN_MANAGEMENT_KEY=uk_... # only for key, licensee and config operations
use AddressZen\Client;
use AddressZen\Types\UsaVerifyMatch;

final class CheckoutController
{
    public function __construct(private readonly Client $client) {}

    public function isDeliverable(string $address): bool
    {
        return $this->client->addressVerify(['query' => $address])->result instanceof UsaVerifyMatch;
    }
}
use AddressZen\Laravel\Facades\AddressZen;

$suggestions = AddressZen::findAddress(['query' => '1010 Cauthen Ln'])->result->hits;

Inject AddressZen\Client, or AddressZen\Contracts\ClientContract to swap in a test double. Each API operation is one method on the client and the facade, such as AddressZen::addressVerify($body).

Requests go through the Guzzle that Laravel ships, found by php-http/discovery, or through Psr\Http\Client\ClientInterface when your application binds one. Publish the config file to change the base URI, the HTTP client binding or the headers sent with every request:

php artisan vendor:publish --tag=addresszen-config
Option Purpose
api_key Required. Your API key or a licensee key, from ADDRESSZEN_API_KEY
management_key Your Management Key for account operations, from ADDRESSZEN_MANAGEMENT_KEY
base_uri Defaults to https://api.addresszen.com/v1
http_client Container binding of a PSR-18 client to use instead of the default
headers Headers sent with every request

Documentation covers configuration, testing with a mock client and the SDK itself.

License

SEE LICENSE IN LICENSE