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

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

ixudra/addressable
==================

Custom Laravel package for address support for the Laravel framework - developed by Ixudra

2.2.0(5y ago)012131MITBladePHP &gt;=7.2CI failing

Since Oct 25Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ixudra/addressable)[ Packagist](https://packagist.org/packages/ixudra/addressable)[ Docs](https://ixudra.be)[ RSS](/packages/ixudra-addressable/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (5)Versions (10)Used By (1)

ixudra/addressable
==================

[](#ixudraaddressable)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5c05a7fd22c7e59c4fe5ddcdb1556f6e3807a5f72c638c2050e3475590955cf2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6978756472612f6164647265737361626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ixudra/addressable)![license](https://camo.githubusercontent.com/731b1f86f6d8f6c9db18cfe32c919ee8f558d566ce296240f127cf8347cb8091/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6978756472612f6164647265737361626c652e737667)[![Total Downloads](https://camo.githubusercontent.com/198cbaa3fea5646c6ba3f5408da8cd184f604d6b9eafad030c958de93d3c77f8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6978756472612f6164647265737361626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ixudra/addressable)

Custom Laravel address package for the Laravel 5 framework - developed by [Ixudra](http://ixudra.be).

The ixudra/addressable package provides an easy to use polymorphic address model that can be linked to one or more models in any Laravel PHP application. The package contains an address model class as well as a factory class that will take care of creating and editing the address model. Additionally, the package will also take care of moving and storing the actual files in the correct locations.

This package can be used by anyone at any given time, but keep in mind that it is optimized for my personal custom workflow. It may not suit your project perfectly and modifications may be in order.

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

[](#installation)

Pull this package in through Composer:

```
    {
        "require": {
            "ixudra/addressable": "1.*"
        }
    }
```

Add the service provider to your `config/app.php` file:

```
    'providers'     => array(

        //...
        Ixudra\Addressable\AddressableServiceProvider::class,

    ),
```

Run package migrations using artisan:

```
    php artisan migrate --package="ixudra/addressable"
```

Alternatively, you can also publish the migrations using artisan:

```
    // Publish all resources from all packages
    php artisan vendor:publish

    // Publish only the resources of the package
    php artisan vendor:publish --provider="Ixudra\\Addressable\\AddressableServiceProvider"
```

Usage
-----

[](#usage)

Create a model with a polymorphic relationship to the `Address` model:

```
    use Illuminate\Database\Eloquent\Model;
    use Ixudra\Addressable\Models\Address;

    class Shop extends Model {

        public function address()
        {
            return $this->morphOne( Address::class, 'reference' );
        }

        public function delete()
        {
            if( !is_null($this->address) ) {
                $this->address->delete();
            }

            parent::delete();
        }

    }
```

You can create new `Address` models using the `AddressFactory` class which is provided in the package. The `AddressFactory` will take care of creating the `Address` model, linking the `Address` to the designated model and moving the uploaded file to the location which is specified in the designated model.

Updating addresses works similar to creating them. All you need to do is provide the correct information and the `AddressFactory` will take care of the rest for you. It is also possible to update the address information without actually updating the uploaded file. This can be done by omitting the `file` attribute from the data that is passed to the factory.

A full example of a factory class that leverages the package functionality can be found in the following example:

```
    use Ixudra\Addressable\Services\Factories\AddressFactory;

    class ShopFactory {

        protected $addressFactory;

        /**
         * @codeCoverageIgnore
         */
        public function __construct(AddressFactory $addressFactory)
        {
            $this->addressFactory = $addressFactory;
        }

        public function create($input, $prefix = '')
        {
            $shop = Shop::create( array( 'name' => $input['name'] ) );
            $this->addressFactory->make( $input, $shop, $prefix );

            return $shop;
        }

        public function modify($shop, $input, $prefix = '')
        {
            $shop = $shop->update( array( 'name' => $input['name'] ) );
            $this->addressFactory->modify( $shop->address, $input, $shop, $prefix );

            return $shop;
        }

    }
```

Finally, the package also provides several views that can be used:

- `bootstrap/default/data/verticalFull.blade.php` which includes a Twitter Bootstrap implementation that will allow you to show the address on a page
- `bootstrap/default/data/verticalSimple.blade.php` which includes a Twitter Bootstrap implementation that will allow you to show the address on a page
- `bootstrap/default/fields/inline.blade.php` which includes a Twitter Bootstrap implementation that can be included in forms to create and/or modify the address information
- `bootstrap/default/fields/verticalFull.blade.php` which includes a Twitter Bootstrap implementation that can be included in forms to create and/or modify the address information
- `bootstrap/default/fields/verticalSimple.blade.php` which includes a Twitter Bootstrap implementation that can be included in forms to create and/or modify the address information

Usage example of both cases can be found in the examples below:

```
    {!! Form::open(array('url' => 'shops', 'method' => 'POST', 'id' => 'createShop', 'class' => 'form-horizontal', 'role' => 'form')) !!}

                {!! Form::label('name', 'Name:', array('class' => 'control-label col-lg-3')) !!}

                    {!! Form::text('name', $input['name'], array('class' => 'form-control')) !!}
                    {!! $errors->first('name', ':message') !!}

        @include('addressable::bootstrap/default/fields/inline')

            {!! Form::submit('Submit', array('class' => 'btn btn-primary')) !!}
            {!! HTML::linkRoute('shops.index', 'Cancel', array(), array('class' => 'btn btn-default')) !!}

    {!! Form::close() !!}
```

The input views assumes one variable `$input`, which is associative array of values of the input data. Required keys depend on the view you want to use. Options are: `street_1`, `street_2`, `number`, `box`, `postal_code`, `city`, `district`, `country`, `longitude`, `latitude`

Both of these variables need to be passed to the view in order to use the default views.

```

                Name:
                {{ $shop->name }}

    @include('addressable::bootstrap/default/data/inline', array('address' => $shop->address))
```

The usage of these views is by no means required to take advantage of the functionality in this package. However, it is worth noting that some views leverage the functionality of the [ixudra/translation](http://github.com/ixudra/translation) package by default. The `ixudra/translation` package is not included as a requirement for this package, but must be pulled in via composer in order to take advantage of the views which are provided by default.

Planning
--------

[](#planning)

- Geocoding
- Additional views

Support
-------

[](#support)

Help me further develop and maintain this package by supporting me via [Patreon](https://www.patreon.com/ixudra)!!

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

Contact
-------

[](#contact)

For package questions, bug, suggestions and/or feature requests, please use the Github issue system and/or submit a pull request. When submitting an issue, always provide a detailed explanation of your problem, any response or feedback your get, log messages that might be relevant as well as a source code example that demonstrates the problem. If not, I will most likely not be able to help you with your problem. Please review the [contribution guidelines](https://github.com/ixudra/addressable/blob/master/CONTRIBUTING.md) before submitting your issue or pull request.

For any other questions, feel free to use the credentials listed below:

Jan Oris (developer)

- Email:
- Telephone: +32 496 94 20 57

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 90.9% 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 ~152 days

Recently: every ~294 days

Total

9

Last Release

1908d ago

Major Versions

1.3.0 → 2.0.02019-11-17

PHP version history (2 changes)1.0.0PHP &gt;=7.0

2.0.0PHP &gt;=7.2

### Community

Maintainers

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

---

Top Contributors

[![elimentz](https://avatars.githubusercontent.com/u/1410811?v=4)](https://github.com/elimentz "elimentz (10 commits)")[![jorenvh](https://avatars.githubusercontent.com/u/8791625?v=4)](https://github.com/jorenvh "jorenvh (1 commits)")

---

Tags

addressixudralaravellocationlaraveladdressIxudra

### Embed Badge

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

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

###  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)[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)
