PHPackages                             veikejin/address - 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. veikejin/address

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

veikejin/address
================

veikejin Address Package

v1.0.2(7y ago)07PHP

Since Feb 14Pushed 7y ago1 watchersCompare

[ Source](https://github.com/veikejin/address)[ Packagist](https://packagist.org/packages/veikejin/address)[ RSS](/packages/veikejin-address/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

地址包
===

[](#地址包)

安装
--

[](#安装)

在composer.json require下添加

```
"veikejin/area":"dev-master"

```

在 repositories 键（如没有，请添加）下添加

```
{
    "type": "git",
    "url": "git@source.shengmage.com:smg/address.git",
    "reference":"master"
},

```

然后再在命令行下运行 `composer update` 更新即可

使用
--

[](#使用)

在需要包含地址功能的 Model (如 User, Shop等)里面引入 `HaveAddress` Trait即可。下面以User为例

```

use SMG\Address\HaveAddress;

class User extends Model
{
    //引入地址Trait
    use HaveAddress;
    ...
}

```

获取一个用户登陆

```
$user = new User();

```

添加地址

```
$user->addresses()->create([
    'name'=>'test',
    'mobile'=>'15511111111',
    'area_id'=>'1966',//地区ID，具体参考smg/area模块地址的ID
    'detail' => '科苑北高新南一道中科大厦',
    'is_default' => 1,//默认地址，可空
    'label' => '公司', //地址标签，可空
    'postal_code'=>',//邮编，可空
    'lat'=>'113.959807',//地址径度，可空
    'lng'=>'22.543491',//地址维度，可空
    'other'=>'{"tel":"075512345678"}',//其它信息JSON字符串，可空
]);
//$user->addresses()->create($request->all());

```

获取用户的地址列表

```
$address_list = $user->addresses

//或者
$address_list = $user->addresses()->with('area')->get()

```

获取用户默认地址

```
$address = $user->address()

```

更新地址

```
$address = $user->addresses()->findOrFail($address);
$address->update(request()->except(['haveaddress_id', 'haveaddress_type', 'id']));

```

删除地址

```
$address = $user->addresses()->findOrFail($address);
$address->delete();

```

其他
--

[](#其他)

本包附带用户地址增删改查API 请使用 `php artisan base:import_api_doc address`发布文档后查看API文档

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

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

Total

2

Last Release

2693d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7094517?v=4)[jys](/maintainers/jys)[@jys](https://github.com/jys)

---

Top Contributors

[![veikejin](https://avatars.githubusercontent.com/u/12483694?v=4)](https://github.com/veikejin "veikejin (3 commits)")

### Embed Badge

![Health badge](/badges/veikejin-address/health.svg)

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

###  Alternatives

[andr-04/jquery.inputmask-multi

Inputmask Multi is a plugin which allows to select a mask of input basing on the beginning of entered data (such as an international phone number)

25310.1k1](/packages/andr-04-jqueryinputmask-multi)

PHPackages © 2026

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