PHPackages                             chantouch/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. chantouch/laravel-addresses

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

chantouch/laravel-addresses
===========================

Simple address and contact management for Laravel.

3.0.0(1y ago)34.8k—9.5%MITPHPPHP ^8.0|^8.1|^8.2|^8.3|^8.4CI failing

Since Mar 7Pushed 1y ago1 watchersCompare

[ Source](https://github.com/chantouchsek/laravel-addresses)[ Packagist](https://packagist.org/packages/chantouch/laravel-addresses)[ Docs](https://github.com/chantouchsek/laravel-addresses)[ RSS](/packages/chantouch-laravel-addresses/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (7)Versions (4)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/83ca34d97e7e3e6e061ebeec1f91fd3a7ddf5ef387681988a39958676dd42270/68747470733a2f2f706f7365722e707567782e6f72672f6368616e746f7563682f6c61726176656c2d6164647265737365732f762f737461626c65)](https://packagist.org/packages/chantouch/laravel-addresses)[![Total Downloads](https://camo.githubusercontent.com/81c81a7ac3c164f876a841ef3dfc245544e3cfdd3510878440b18e34ef50921d/68747470733a2f2f706f7365722e707567782e6f72672f6368616e746f7563682f6c61726176656c2d6164647265737365732f646f776e6c6f616473)](https://packagist.org/packages/chantouch/laravel-addresses)[![License](https://camo.githubusercontent.com/26fa5112e7875cba8626a8e2c0ec333c1ab027b43859f10692fb797a39e4f032/68747470733a2f2f706f7365722e707567782e6f72672f6368616e746f7563682f6c61726176656c2d6164647265737365732f6c6963656e7365)](https://packagist.org/packages/chantouch/laravel-addresses)

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

[](#laravel-addresses)

Simple address and contact management for Laravel with automatically geocoding to add longitude and latitude.

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

[](#installation)

Require the package from your `composer.json` file

```
"require": {
	"chantouch/laravel-addresses": "^1.0"
}
```

and run `$ composer update` or both in one with `$ composer require chantouch/laravel-addresses`.

Configuration &amp; Migration
-----------------------------

[](#configuration--migration)

```
$ php artisan vendor:publish --provider="Chantouch\Addresses\AddressesServiceProvider"
```

This will publish a `config/laravel-address.php` and some migration files, that you'll have to run:

```
$ php artisan migrate
```

For migrations to be properly published ensure that you have added the directory `database/migrations` to the classmap in your projects `composer.json`.

Usage
-----

[](#usage)

First, add our `HasAddresses` trait to your model.

```

```

##### Add an Address to a Model

[](#add-an-address-to-a-model)

```
$post = Post::find(1);
$post->addAddress([
    'street'     => '123 Example Drive',
    'city'       => 'Vienna',
    'post_code'  => '1110',
    'country'    => 'AT', // ISO-3166-2 or ISO-3166-3 country code
    'is_primary' => true, // optional flag
]);
```

Alternativly you could do...

```
$address = [
    'street'     => '123 Example Drive',
    'city'       => 'Vienna',
    'post_code'  => '1110',
    'country'    => 'AT', // ISO-3166-2 or ISO-3166-3 country code
    'is_primary' => true, // optional flag
];
$post->addAddress($address);
```

Available attributes are `street`, `street_extra`, `city`, `post_code`, `state`, `country`, `state`, `notes` (for internal use). You can also use custom flags like `is_primary`, `is_billing` &amp; `is_shipping`. Optionally you could also pass `lng` and `lat`, in case you deactivated the included geocoding functionality and want to add them yourself.

##### Check if Model has Addresses

[](#check-if-model-has-addresses)

```
if ($post->hasAddresses()) {
    // Do something
}
```

##### Get all Addresses for a Model

[](#get-all-addresses-for-a-model)

```
$addresses = $post->addresses()->get();
```

##### Get primary/billing/shipping Addresses

[](#get-primarybillingshipping-addresses)

```
$address = $post->getPrimaryAddress();
$address = $post->getBillingAddress();
$address = $post->getShippingAddress();
```

##### Update an Address for a Model

[](#update-an-address-for-a-model)

```
$address = $post->addresses()->first(); // fetch the address

$post->updateAddress($address, $new_attributes);
```

##### Delete an Address from a Model

[](#delete-an-address-from-a-model)

```
$address = $post->addresses()->first(); // fetch the address

$post->deleteAddress($address); // delete by passing it as argument
```

##### Delete all Addresses from a Model

[](#delete-all-addresses-from-a-model)

```
$post->flushAddresses();
```

Contacts
--------

[](#contacts)

First, add our `HasContacts` trait to your model.

```

```

##### Add a Contact to a Model

[](#add-a-contact-to-a-model)

```
$post = Team::find(1);
$post->addContact([
    'first_name' => 'Alex',
    'website'    => 'https://twitter.com/AMPoellmann',
    'is_primary' => true, // optional flag
]);
```

Relate Addresses with Contacts
------------------------------

[](#relate-addresses-with-contacts)

Above all, `addresses` and `contacts` can be connected with an optional One To Many relationship. Like so you could assign multiple contacts to an address and retrieve them like so:

```
use Chantouch\Addresses\Models\Address;

$address = Address::find(1);
$contacts = $address->contacts;

foreach ($contacts as $contact) {
    //
}
```

```
use Chantouch\Addresses\Models\Address;

$contact = Address::find(1)
                  ->contacts()
                  ->first();
```

```
use Chantouch\Addresses\Models\Contact;

$contact = Contact::find(1);

return $contact->address->getHtml();
```

License
-------

[](#license)

Licensed under [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance46

Moderate activity, may be stable

Popularity25

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~380 days

Total

3

Last Release

403d ago

Major Versions

v1.0.0 → 2.0.02024-05-06

2.0.0 → 3.0.02025-04-05

PHP version history (3 changes)v1.0.0PHP ^7.4|^8.0|^8.1|^8.2

2.0.0PHP ^8.0|^8.1|^8.2|^8.3

3.0.0PHP ^8.0|^8.1|^8.2|^8.3|^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/4806d28fde38fb461e48b768d1dc0493baf1e6c4dd60925b7ba33a17643e7a02?d=identicon)[chantouchsek](/maintainers/chantouchsek)

---

Top Contributors

[![chantouchsek](https://avatars.githubusercontent.com/u/26726287?v=4)](https://github.com/chantouchsek "chantouchsek (22 commits)")

---

Tags

addresslaravellaraveladdressescontactschantouch

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/chantouch-laravel-addresses/health.svg)

```
[![Health](https://phpackages.com/badges/chantouch-laravel-addresses/health.svg)](https://phpackages.com/packages/chantouch-laravel-addresses)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[lecturize/laravel-addresses

Simple address and contact management for Laravel.

20164.1k](/packages/lecturize-laravel-addresses)[glhd/special

1929.4k](/packages/glhd-special)[bjuppa/laravel-blog

Add blog functionality to your Laravel project

483.3k2](/packages/bjuppa-laravel-blog)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
