PHPackages                             hichxm/laravel-phones - 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. hichxm/laravel-phones

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

hichxm/laravel-phones
=====================

Laravel sortable packages for Laravel ecosystem by Hichxm

v1.1(2y ago)08MITPHP

Since Apr 1Pushed 2y ago1 watchersCompare

[ Source](https://github.com/hichxm/laravel-phones)[ Packagist](https://packagist.org/packages/hichxm/laravel-phones)[ Docs](https://github.com/hichxm/laravel-sortable)[ RSS](/packages/hichxm-laravel-phones/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (8)Versions (3)Used By (0)

Laravel Phones
==============

[](#laravel-phones)

Laravel Phones is a package that provides a simple way to manage phones numbers related to models in your Laravel application.

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

[](#installation)

You can install the package via composer:

```
composer require hichxm/laravel-phones
```

You can publish the config file with:

```
php artisan vendor:publish --provider="Hichxm\LaravelPhones\LaravelPhonesServiceProvider" --tag="config"
```

You need to publish and run the migrations with:

```
php artisan vendor:publish --provider="Hichxm\LaravelPhones\LaravelPhonesServiceProvider" --tag="migrations"
```

After the migration has been published you can create the phones table by running the migrations:

```
php artisan migrate
```

Usage
-----

[](#usage)

First, add the `HasPhones` trait to the model you want to associate phones.

```
use Hichxm\LaravelPhones\Traits\HasPhones;

class User extends Model
{
    use HasPhones;
}
```

Then, you can use the `phones` relationship to manage the phones numbers.

```
$user = User::find(1);

$user->phones()->create([
    'number' => '1234567890',
    'type' => 'mobile',
]);

$user->addPhone('+33987654321');
$user->addPhone('0987654321', ['FR']); // with country code, will be stored as +33987654321
$user->addPhone('+33612345678', [], 'mobile'); // with type
```

You can also use the `phones` relationship to retrieve the phones numbers.

```
$user = User::find(1);

$phones = $user->phones;
$mobilePhones = $user->phones()->where('type', 'mobile')->get();

// Use scopes
$phones = $user->getPhones();
$mobilePhones = $user->getPhones('mobile'); // specify the type
$firstPhone = $user->getFirstPhone(); // get the first phone
```

Methods and Relations
---------------------

[](#methods-and-relations)

### `HasPhones` methods and relations

[](#hasphones-methods-and-relations)

> List of methods available when using the [`HasPhones`](./src/Models/Concerns/HasPhones.php) trait.

#### Relation : `phones(): MorphMany`

[](#relation--phones-morphmany)

Get the phones relationship ordered.

#### Relation : `unorderedPhones(): MorphMany`

[](#relation--unorderedphones-morphmany)

Get the phones relationship without any order.

#### Method : `addPhone($number, $countries = [], $type = null): Phone`

[](#method--addphonenumber-countries---type--null-phone)

Add a phone number to the model.

#### Method : `getPhones($type = null): Collection|Phone[]`

[](#method--getphonestype--null-collectionphone)

Get the phones numbers related to the model.

#### Method : `getFirstPhone($type = null): Phone`

[](#method--getfirstphonetype--null-phone)

Get the first phone number related to the model.

Testing
-------

[](#testing)

```
./vendor/bin/phpunit
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

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

Total

2

Last Release

771d ago

### Community

Maintainers

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

---

Top Contributors

[![hichxm](https://avatars.githubusercontent.com/u/12587585?v=4)](https://github.com/hichxm "hichxm (13 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hichxm-laravel-phones/health.svg)

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

###  Alternatives

[spatie/laravel-schedule-monitor

Monitor scheduled tasks in a Laravel app

9815.7M9](/packages/spatie-laravel-schedule-monitor)[ashallendesign/short-url

A Laravel package for creating shortened URLs for your web apps.

1.4k1.9M4](/packages/ashallendesign-short-url)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[kirschbaum-development/commentions

A package to allow you to create comments, tag users and more

12369.2k](/packages/kirschbaum-development-commentions)[laracraft-tech/laravel-useful-additions

A collection of useful Laravel additions!

58109.4k](/packages/laracraft-tech-laravel-useful-additions)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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