PHPackages                             divineomega/laravel-addresses - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Admin Panels](/categories/admin)
4. /
5. divineomega/laravel-addresses

Abandoned → [jord-jd/laravel-addresses](/?search=jord-jd%2Flaravel-addresses)Library[Admin Panels](/categories/admin)

divineomega/laravel-addresses
=============================

Laravel Addresses

v2.0.0(2mo ago)97.3k3[2 issues](https://github.com/Jord-JD/laravel-addresses/issues)LGPL-3.0-onlyPHPPHP &gt;=7.1CI failing

Since Feb 1Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/Jord-JD/laravel-addresses)[ Packagist](https://packagist.org/packages/divineomega/laravel-addresses)[ GitHub Sponsors](https://github.com/DivineOmega)[ RSS](/packages/divineomega-laravel-addresses/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (6)Versions (18)Used By (0)

Laravel Addresses
=================

[](#laravel-addresses)

Laravel Addresses is a package that lets you associate addresses with your Laravel Eloquent models.

Features:

- Automatic geocoding of addresses on change, provided by the Google Maps API
- Validation of address details (country, postcode)
- Conversion of ISO country code to country name
- Ability to store meta data about addresses - e.g. `['type' => 'delivery', 'name' => 'home_address']`

Compatibility
-------------

[](#compatibility)

This package supports Laravel versions 5.6 through 10.

Installation
------------

[](#installation)

To install Laravel Addresses, just run the following Composer command.

```
composer require jord-jd/laravel-addresses
```

Configuration
-------------

[](#configuration)

Run the following Artisan command to publish the configuration file.

```
php artisan vendor:publish --provider="JordJD\LaravelAddresses\ServiceProvider" --force
```

This will create the default configuration file at `config/addresses.php`.

Note that by default, you require a Google Maps API key in order to provide address geocoding and distance calculations. If you do not wish to use geocoding, this can be disabled in the configuration.

### Strict geocoding

[](#strict-geocoding)

By default, geocoding is configured as "lenient"; if, for example, the name of a real city is given but the postcode and street address refer to a nonexistent place, it will geocode as the center of that city.

Set the `geocoding.strict` flag to `true` in the configuration file to instead fail to geocode in this scenario.

Usage
-----

[](#usage)

Assign the `HasAddresses` trait to the model you wish to have associated addresses. For example, you could give the default `User` model address, as shown below.

```
