PHPackages                             neuecommerce/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. [Database &amp; ORM](/categories/database)
4. /
5. neuecommerce/addresses

ActiveLibrary[Database &amp; ORM](/categories/database)

neuecommerce/addresses
======================

Addresses is a polymorphic Laravel package, for addressbook management. Adding addresses to any Eloquent model was never this easy.

212.5k

Since Apr 1Compare

[ Source](https://github.com/neuecommerce/addresses)[ Packagist](https://packagist.org/packages/neuecommerce/addresses)[ RSS](/packages/neuecommerce-addresses/feed)WikiDiscussions Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Addresses for Laravel
=====================

[](#addresses-for-laravel)

[![GitHub Tests Action Status](https://github.com/neuecommerce/addresses/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/neuecommerce/addresses/actions?query=workflow%3Atests)[![GitHub Code Analysis Action Status](https://github.com/neuecommerce/addresses/actions/workflows/code-analysis.yml/badge.svg?branch=main)](https://github.com/neuecommerce/addresses/actions?query=workflow%3Acode-analysis)[![Software License](https://camo.githubusercontent.com/e022fabb2e322f896b352fc532d8b3c1d6a3cfec13d3885fc5a836586b539f45/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6e657565636f6d6d657263652f6164647265737365733f6c6162656c3d4c6963656e7365)](https://opensource.org/licenses/MIT)[![Latest Version on Packagist](https://camo.githubusercontent.com/23bfcaed9a2b48d991203f2bfd745463d93167b2f4f4b0d815e579e7cc1ea477/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e657565636f6d6d657263652f6164647265737365732e7376673f6c6162656c3d5061636b6167697374)](https://github.com/neuecommerce/neuecommerce)[![Total Downloads](https://camo.githubusercontent.com/6a37aecf04662dffa5ce66c19a1bb29b94a77acfe7f2c8335e4cb745634faa8b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e657565636f6d6d657263652f6164647265737365732e7376673f6c6162656c3d446f776e6c6f616473)](https://github.com/neuecommerce/neuecommerce)

Addresses is a polymorphic Laravel package, for addressbook management.

Adding addresses to any Eloquent model was never this easy and the possibilities of address organisation is also possible since you'll be able to assign a custom type like `shipping`, `billing`, etc.. to each address, which gives the possibility of having one default address per type of address. For example, have one default `shipping address` and one default `billing address`, which is very common on e-commerce applications.

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

[](#installation)

1. Install the package via Composer:

```
composer require neuecommerce/addresses
```

2. Publish the migrations (optional):

```
php artisan vendor:publish --tag="neuecommerce-addresses-migrations"
```

3. Publish the configuration file (optional):

```
php artisan vendor:publish --tag="neuecommerce-addresses-config"
```

4. Run the migrations:

```
php artisan migrate
```

Implementation
--------------

[](#implementation)

In order to add addresses support to your Eloquent models, you'll need to ensure that your model implements the `NeueCommerce\Addresses\Contracts\HasManyAddressesInterface` interface and the `NeueCommerce\Addresses\Traits\HasManyAddresses` trait.

Here's an example of a model with the proper implementation:

```
