PHPackages                             cherif/algerian-mobile-phone-number-laravel - 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. cherif/algerian-mobile-phone-number-laravel

ActiveLaravel-package[Database &amp; ORM](/categories/database)

cherif/algerian-mobile-phone-number-laravel
===========================================

Allows to use cherif/algerian-mobile-number in Laravel

v0.1.0(5y ago)10231MITPHP

Since Sep 17Pushed 5y ago1 watchersCompare

[ Source](https://github.com/cherifGsoul/algerian-mobile-phone-number-laravel)[ Packagist](https://packagist.org/packages/cherif/algerian-mobile-phone-number-laravel)[ RSS](/packages/cherif-algerian-mobile-phone-number-laravel/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

cherif/algerian-mobile-phone-number-laravel
===========================================

[](#cherifalgerian-mobile-phone-number-laravel)

Allows to use [cherif/algerian-mobile-phone-number](https://github.com/cherifGsoul/php-algerian-mobile-phone-number) value object with [Laravel](https://laravel.com/).

Installtion
-----------

[](#installtion)

The recommended way of installation is by using [Packagist](https://packagist.org/packages/cherif/algerian-mobile-phone-number-laravel) and [Composer](http://getcomposer.org/).

The following command should be executed in order to add the package as a requirement to `composer.json` of a project:

```
$ composer require cherif/algerian-mobile-phone-number-laravel
```

Usage:
------

[](#usage)

The package have 2 main classes to use `Cherif\AlgerianMobilePhoneNumber\Laravel\Casts\AlgerianMobilePhoneNumberCast` and `Cherif\AlgerianMobilePhoneNumber\Laravel\Rules\AlgerianMobilePhoneNumberRule` to cast models attributes from/to the phone number value object and validate the request respectively:

### Eloquent model attribute casting:

[](#eloquent-model-attribute-casting)

To use `Cherif\AlgerianMobilePhoneNumber\AlgerianMobilePhoneNumber\AlgerianMobilePhoneNumber` value object instance as Eloquent model attribute use the casting class in the `casts` model's property like the following:

```
namespace App\Models;

use Cherif\AlgerianMobilePhoneNumber\Laravel\Casts\AlgerianMobilePhoneNumberCast;
use Illuminate\Database\Eloquent\Model;

class Customer extends Model
{
    protected $casts = [
        'mobile_phone_number' => AlgerianMobilePhoneNumberCast::class
    ];
}
```

The definition above allows to use the `mobile_phone_number` as value object when reading the attribute, the casting to string value will be handled during setting the value and persisting the model in the database.

### Validation:

[](#validation)

The mobile phone validator is `Cherif\AlgerianMobilePhoneNumber\Laravel\Rules\AlgerianMobilePhoneNumberRule` it can be used with the request to validate the input:

```
use Cherif\AlgerianMobilePhoneNumber\Laravel\Rules\AlgerianMobilePhoneNumberRule;

// ...

/**
 * Store a new customer.
 *
 * @param  Request  $request
 * @return Response
 */
public function store(Request $request)
{
    $validatedData = $request->validate([
        'mobilePhoneNumber' => ['required', new AlgerianMobilePhoneNumberRule],
    ]);

    // The customer is valid...
}
```

Contribution
------------

[](#contribution)

Contributions are welcome to make this library better.

- Clone the repo:

```
$ git clone git@github.com:cherifGsoul/algerian-mobile-phone-laravel.git
```

and enter to the cloned repository directory.

- Install dependencies:

```
$ composer install
```

### Testing:

[](#testing)

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

License
-------

[](#license)

[MIT License](LICENSE).

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% 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

Unknown

Total

1

Last Release

2063d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f4be70b1b1d59ebec6b57be354923c82f8c9d445e612398e73a838c48130183b?d=identicon)[cherif\_b](/maintainers/cherif_b)

---

Top Contributors

[![cherifGsoul](https://avatars.githubusercontent.com/u/109013?v=4)](https://github.com/cherifGsoul "cherifGsoul (6 commits)")[![MahiBegoug](https://avatars.githubusercontent.com/u/51762779?v=4)](https://github.com/MahiBegoug "MahiBegoug (2 commits)")

---

Tags

eloquenthacktoberfesthacktoberfest2022laravelphp

### Embed Badge

![Health badge](/badges/cherif-algerian-mobile-phone-number-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/cherif-algerian-mobile-phone-number-laravel/health.svg)](https://phpackages.com/packages/cherif-algerian-mobile-phone-number-laravel)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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