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

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

metamel/laravel-addresses
=========================

Metamel Addresses is a polymorphic Laravel package, for address book management. You can add addresses to any eloquent model with ease.

v2.1.1(2y ago)42.8k↓39.6%[1 PRs](https://github.com/metamel/laravel-addresses/pulls)MITPHPPHP ^8.2

Since Jul 18Pushed 1y agoCompare

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

READMEChangelog (6)Dependencies (6)Versions (15)Used By (0)

Laravel-Addresses (Base on rinvex/laravel-addresses)
====================================================

[](#laravel-addresses-base-on-rinvexlaravel-addresses)

---

A polymorphic Laravel package to manage addresses. This package allow you to add addresses to any eloquent model with ease.

[![Packagist](https://camo.githubusercontent.com/b42cbbe8508af9dbb3f7effa09ba86637006f2ec51fca2b4c5a7977a6510a6b9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6574616d656c2f6c61726176656c2d6164647265737365732e7376673f6c6162656c3d5061636b6167697374267374796c653d666c61742d737175617265)](https://packagist.org/packages/metamel/laravel-addresses)[![Issues](https://camo.githubusercontent.com/aebbef588ce494aa5f265e58af52bb8a6d6c4efcbf26743d6979048737d1a170/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6d6574616d656c2f6c61726176656c2d616464726573736573)](https://github.com/metamel/laravel-addresses/issues)[![Forks](https://camo.githubusercontent.com/da465c3b20a5a400d201fde4796e7ac7fd98c41d94ec83c6acbe0ea8f5fd8485/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f6d6574616d656c2f6c61726176656c2d616464726573736573)](https://camo.githubusercontent.com/da465c3b20a5a400d201fde4796e7ac7fd98c41d94ec83c6acbe0ea8f5fd8485/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f6d6574616d656c2f6c61726176656c2d616464726573736573)[![StyleCI](https://camo.githubusercontent.com/046431f88bf9338b55834b9b49d96ca22ccd12b532975d2023045f3e9762edf6/68747470733a2f2f7374796c6563692e696f2f7265706f732f38373438353037392f736869656c64)](https://github.styleci.io/repos/514330847)[![License](https://camo.githubusercontent.com/596bac4034822adbd54432ab49d23bbd469ab56f6b04cb855d9e8fb8f9cfd322/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6574616d656c2f6c61726176656c2d616464726573736573)](https://github.com/metamel/laravel-addresses/blob/main/LICENSE)

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

[](#installation)

1. Install the package via composer:

    ```
    composer require metamel/laravel-addresses
    ```
2. Publish config file:

    ```
    php artisan vendor:publish --tag=addresses-config
    ```
3. Execute migrations via the following command:

    ```
    php artisan migrate
    ```
4. Done!

Usage
-----

[](#usage)

To add addresses support to your eloquent models simply use `\Metamel\Addresses\Traits\Addressable` trait.

### Manage your addresses

[](#manage-your-addresses)

```
// Get instance of your model
$user = new \App\Models\User::find(1);

// Create a new address
$user->addresses()->create([
    'label' => 'Default Address',
    'name' => 'John Doe',
    'organization' => 'Something Went Wrong LTD.',
    'country_code' => 'gb',
    'street' => '10 Downing Street',
    'state' => 'somewhere over the rainbow',
    'city' => 'London',
    'postal_code' => 'SW1A 2AA',
    'latitude' => '51.503364',
    'longitude' => '-0.127625',
    'is_primary' => true,
    'is_billing' => true,
    'is_shipping' => true,
]);

// Create multiple new addresses
$user->addresses()->createMany([
    [...],
    [...],
    [...],
]);

// Find an existing address
$address = app('metamel.addresses.models.address')->find(1);

// Update an existing address
$address->update([
    'label' => 'Default Work Address',
]);

// Delete address
$address->delete();

// Alternative way of address deletion
$user->addresses()->where('id', 123)->first()->delete();
```

### Manage your addressable model

[](#manage-your-addressable-model)

The API is intuitive and very straight forward, so let's give it a quick look:

```
// Get instance of your model
$user = new \App\Models\User::find(1);

// Get attached addresses collection
$user->addresses;

// Get attached addresses query builder
$user->addresses();

// Scope Primary Addresses
$primaryAddresses = app('metamel.addresses.models.address')->isPrimary()->get();

// Scope Billing Addresses
$billingAddresses = app('metamel.addresses.models.address')->isBilling()->get();

// Scope Shipping Addresses
$shippingAddresses = app('metamel.addresses.models.address')->isShipping()->get();

// Scope Addresses in the given country
$egyptianAddresses = app('metamel.addresses.models.address')->InCountry('eg')->get();

// Find all users within 5 kilometers radius from the latitude/longitude 31.2467601/29.9020376
$fiveKmAddresses = \App\Models\User::findByDistance(5, 'kilometers', '31.2467601', '29.9020376')->get();

// Alternative method to find users within certain radius
$user = new \App\Models\User();
$users = $user->lat('51.503364')->lng('-0.127625')->within(5, 'kilometers')->get();
```

Changelog
---------

[](#changelog)

Refer to the [Changelog](CHANGELOG.md) for a full history of the project.

Support
-------

[](#support)

The following support channels are available at your fingertips:

- [Help on](https://github.com/metamel/laravel-addresses/issues)

Contributing &amp; Protocols
----------------------------

[](#contributing--protocols)

Thank you for considering contributing to this project! The contribution guide can be found in [CONTRIBUTING.md](packages/metamel/laravel-addresses/CONTRIBUTING.md).

Bug reports, feature requests, and pull requests are very welcome.

- [Versioning](packages/metamel/laravel-addresses/CONTRIBUTING.md#versioning)
- [Pull Requests](packages/metamel/laravel-addresses/CONTRIBUTING.md#pull-requests)
- [Coding Standards](packages/metamel/laravel-addresses/CONTRIBUTING.md#coding-standards)
- [Feature Requests](packages/metamel/laravel-addresses/CONTRIBUTING.md#feature-requests)
- [Git Flow](packages/metamel/laravel-addresses/CONTRIBUTING.md#git-flow)

License
-------

[](#license)

This software is released under [The MIT License (MIT)](LICENSE).

(c) 2022 Metamel, Some rights reserved.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance27

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 54.5% 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 ~80 days

Recently: every ~11 days

Total

9

Last Release

755d ago

Major Versions

v1.0.1 → v2.0.02023-08-04

PHP version history (2 changes)v1.0.0PHP ^8.0.0

v2.1.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/f5f28c39301f74df837cea677b5d7b591e8e3fecb5f6cbc6f5a00bb41fca7664?d=identicon)[makotokenchy](/maintainers/makotokenchy)

---

Top Contributors

[![tmalter](https://avatars.githubusercontent.com/u/41366505?v=4)](https://github.com/tmalter "tmalter (6 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

laraveladdresspostalbillingmodeleloquentstatecountrycityaddressablelatitudelongitudeshippingrinvexpolymorphicstreetprimarymetamel

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[rinvex/laravel-categories

Rinvex Categories is a polymorphic Laravel package, for category management. You can categorize any eloquent model with ease, and utilize the power of Nested Sets, and the awesomeness of Sluggable, and Translatable models out of the box.

470161.6k3](/packages/rinvex-laravel-categories)[rinvex/laravel-tenants

Rinvex Tenants is a contextually intelligent polymorphic Laravel package, for single db multi-tenancy. You can completely isolate tenants data with ease using the same database, with full power and control over what data to be centrally shared, and what to be tenant related and therefore isolated from others.

823.5k10](/packages/rinvex-laravel-tenants)

PHPackages © 2026

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