PHPackages                             nh/addressable - 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. nh/addressable

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

nh/addressable
==============

Make a Laravel model addressable

1.2.2(3y ago)043MITPHP

Since Aug 26Pushed 3y ago1 watchersCompare

[ Source](https://github.com/NatachaH/laravel-addressable)[ Packagist](https://packagist.org/packages/nh/addressable)[ RSS](/packages/nh-addressable/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (5)DependenciesVersions (7)Used By (0)

Installation
============

[](#installation)

Install the package via composer:

```
composer require nh/addressable

```

Publish the databases and the models for the addresses:

```
php artisan vendor:publish --tag=addressable

```

To make a model addressable, add the **Addressable** trait to your model:

```
use Nh\Addressable\Traits\Addressable;

use Addressable;

/**
 * Default addressable type.
 * @var array
 */
protected $addressable = [
  'type' => null
];

```

Views
=====

[](#views)

Add/Update an/some address/es automatic
---------------------------------------

[](#addupdate-ansome-addresses-automatic)

You can add a single address *The name must be address\['field'\]*

```

```

Or multiple addresses *The name must be addresses\['type'\]\['field'\]*

```

```

Model
=====

[](#model)

Attributes
----------

[](#attributes)

You can retrieve all addresses of a model with

```
$user->addresses

```

Or you can retrieve the default address. *You have to add in the model the default address type*

```
$user->address

```

Or you can retrieve all addresses (or only the last one) by type.

```
$user->addressesByType('billing')
$user->addressByType('billing')

```

And you can retrieve the postal address postal formated.

```
$user->address->postal

```

You can check if a model have some addresses

```
$customer->hasAddresses() // Check if there any addresses
$customer->hasAddresses(false,'default') // Check if there any addresses with type 'default'
$customer->hasAddresses(true) // Check if there any addresses, even in the trash
$customer->hasAddresses(true,'default') // Check if there any addresses with type 'default', even in the trash

```

Functions
---------

[](#functions)

To add **an** address

```
$user->setAddress(['type' => 'billing', 'street_1' => 'My streetname']);

```

To add **multiple** addresses

```
$user->setAddresses([
    'billing' => ['street_1' => 'My streetname for Billing'],
    'shipping' => ['street_1' => 'My streetname for Shipping'],
])

```

Events
======

[](#events)

You can use the **AddressEvent** for dispatch events that happen to the addresses. *You can pass a name, the parent model, the address model (or null) and the number of addresses affected*

```
AddressEvent::dispatch('my-event', $model, $address, 1);

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 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 ~158 days

Recently: every ~196 days

Total

6

Last Release

1300d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/47361520c40f781d7d5b39e26b3194800a35e89c4819c220ea3eaaaa907c34ec?d=identicon)[NatachaH](/maintainers/NatachaH)

---

Top Contributors

[![NatachaH](https://avatars.githubusercontent.com/u/24412486?v=4)](https://github.com/NatachaH "NatachaH (29 commits)")

### Embed Badge

![Health badge](/badges/nh-addressable/health.svg)

```
[![Health](https://phpackages.com/badges/nh-addressable/health.svg)](https://phpackages.com/packages/nh-addressable)
```

###  Alternatives

[samdark/sitemap

Sitemap and sitemap index builder

5491.4M37](/packages/samdark-sitemap)[shivas/versioning-bundle

Symfony application versioning, simple console command to manage version (with providers e.g. git tag) of your application using Semantic Versioning 2.0.0 recommendations

1121.2M1](/packages/shivas-versioning-bundle)[yohang88/letter-avatar

Generate user avatar using name initials letter.

126529.5k2](/packages/yohang88-letter-avatar)[coolsam/flatpickr

Flatpickr input for Filamentphp

96205.9k2](/packages/coolsam-flatpickr)[statamic/seo-pro

65440.7k](/packages/statamic-seo-pro)[php-stubs/generator

Generate stubs from any PHP code for IDE completion and static analysis.

79291.0k45](/packages/php-stubs-generator)

PHPackages © 2026

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