NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages

The published config/addresses.php in full (comments trimmed):

use RoundlyConsulting\Addresses\Address;
use RoundlyConsulting\Addresses\Enums\AddressType;

return [
    'model' => Address::class,

    'key_type' => env('ADDRESSES_KEY_TYPE', 'bigint'),   // bigint | uuid | ulid

    'default_type' => AddressType::Default->value,

    'normalise_country' => true,

    'country_resolver' => null,

    'facade_alias' => 'Addresses',
];

Every key

KeyDefaultEnvPurpose
modelAddress::class—The Eloquent model the trait, builder, actions and facade read and write through. Must be the package model or a subclass of it — anything else throws InvalidConfigurationException.
key_typebigintADDRESSES_KEY_TYPEKey type of the owner models — bigint, uuid or ulid. Types the addressable morph column; set it before you migrate. Matching ignores case and padding; any other value throws InvalidConfigurationException when the migration runs.
default_type'default'—The AddressType value an address gets when its creator names none — the builder without type(), AddressData or createAddress() without type. Not set (null or blank) means default; any other value that is not an AddressType case (matching ignores case and padding) throws InvalidAddressTypeException when such an address is built.
normalise_countrytrue—Trim, upper-case and check that country codes are two or three letters on the way in. false (or 'false', '0', 'off' as a string) stores them as given, trimmed; inCountry() then matches case-insensitively. Any other non-boolean value throws InvalidConfigurationException.
country_resolvernull—Class-string of your CountryResolver, bound as a singleton — resolves country names and lets you geocode. Not set (null or blank) binds none; any other value must name a CountryResolver class, or resolving it throws InvalidConfigurationException.
facade_alias'Addresses'—The global alias the service provider registers for the facade. A string renames it; null or a false spelling (false, 0, off, no) skips it — the package declares no other alias. A blank value is not set and keeps Addresses.

Environment

Only the owner key type is env-backed — the other keys are literal values you change in the published file:

ADDRESSES_KEY_TYPE=uuid

default_type

default_type is the type an address gets when its creator names none — the fluent builder without ->type(), AddressData without type and createAddress() without type all fall back to it, and a key that is not set (absent, null or blank) means AddressType::Default. It is read when such an address is built — matching ignores case and padding — so any other value that is not an AddressType case (default, billing, shipping, home, work, office) throws InvalidAddressTypeException at that point:

// config/addresses.php
'default_type' => 'billing',

// an address created without a type now gets AddressType::Billing
$customer->newAddress()
    ->in('Bratislava')->at('Somewhere 1')->postalCode('81101')->country('SK')
    ->save();

facade_alias

Set facade_alias to another name (for example Locations) to register the facade under that alias, or to null (or a false spelling: false, 0, off, no) to skip the alias entirely; a blank value is not set and keeps Addresses. The alias comes from config only — the package’s composer.json declares none for package discovery — and importing RoundlyConsulting\Addresses\Facades\Addresses works either way.

Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

More ways to support, including crypto

By donating, you agree to our donation terms.

Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.