Installation
Require the package. The service provider is auto-discovered and registers the Addresses facade alias from config — no manual registration:
composer require roundly-consulting/addresses-for-laravelPublish and run the migration
The migration is publish-only: the package never loads it, so php artisan migrate creates nothing until you have published it. It lands in database/migrations with a timestamp, the published copy is yours to edit, and republishing with --force overwrites that same file instead of adding a second copy:
php artisan vendor:publish --tag="addresses-migrations"
php artisan migrateIf the models that will own addresses use UUID or ULID primary keys, set ADDRESSES_KEY_TYPE before you run the migration — the key type is baked into the addressable column (see Database schema & key types).
Publish the config (optional)
Every key has a working default, so you only publish config/addresses.php to change one:
php artisan vendor:publish --tag="addresses-config"The package exposes exactly two publish tags — addresses-migrations and addresses-config. It ships no routes, views, translations or Artisan commands.
Check the setup
The package adds an Addresses section to php artisan about — the model, table, default type, whether country normalisation is on, the resolver’s class base name (or NONE) and the facade alias (or DISABLED); a misconfigured default type, resolver or alias shows as INVALID. Stored addresses never appear there:
php artisan about --only=addressesNext steps
- Add the HasAddresses trait to every model that owns addresses.
- Create addresses with the fluent builder or an AddressData DTO.
- Read them back with primaryAddress(), addressesOfType() or the query scopes.
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 cryptoBy 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.