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 yesterday

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 13% 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

823d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12587585?v=4)[Hichxm'S](/maintainers/Hichxm)[@hichxm](https://github.com/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

[flarum/core

Delightfully simple forum software.

201.4M2.3k](/packages/flarum-core)[ysfkaya/filament-phone-input

A phone input component for Laravel Filament

3161.3M25](/packages/ysfkaya-filament-phone-input)[pimcore/data-importer

Adds a comprehensive import functionality to Pimcore Datahub

46855.5k5](/packages/pimcore-data-importer)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9421.6k61](/packages/open-dxp-opendxp)

PHPackages © 2026

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