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

    'types' => [
        AddressType::Default->value,
        AddressType::Billing->value,
        AddressType::Shipping->value,
        AddressType::Home->value,
        AddressType::Work->value,
        AddressType::Office->value,
    ],

    '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.
typesthe six AddressType values—The allow-list of address types. Every write refuses a type not listed with InvalidAddressTypeException; reads are unchecked. Add lowercase keys ('registered'), with an optional label ('postal' => 'Postal address' or 'operating' => ['label' => 'Operating site']); a comma-separated string works too. null, blank or [] means the six built-ins; a malformed list throws InvalidConfigurationException.
default_type'default'—The type an address gets when its creator names none — the builder without type(), AddressData or createAddress() without type. Must be one of types, built-in or custom (matching ignores case and padding). Not set (null or blank) means default; any other value 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

types

types is the allow-list of address types. It ships the six AddressType values, so nothing changes until you set it; once you do, it is the whole list — a built-in you leave out is refused like an unknown key. Custom keys need no migration, since the type column is a plain string. See Address types:

// config/addresses.php — the whole allow-list: a built-in you leave out is refused too
'types' => [
    'default',
    'billing',
    'registered' => 'Registered office',          // a type and its label
    'postal',                                     // labelled "Postal"
    'operating' => ['label' => 'Operating site'],
],

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 may name any configured type, built-in or custom. It is read when such an address is built — matching ignores case and padding — so a value that is not in types throws InvalidAddressTypeException at that point:

// config/addresses.php
'default_type' => 'billing',   // or a custom key listed in 'types'

// 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.