PHPackages                             iraq-laravel/phone - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. iraq-laravel/phone

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

iraq-laravel/phone
==================

Iraqi phone number validation, operator detection, and E.164 normalization for Laravel.

v1.0.0(1mo ago)11↓100%MITPHPPHP ^8.1CI passing

Since Mar 19Pushed 1mo agoCompare

[ Source](https://github.com/hamza200411/iraq-laravel-phone)[ Packagist](https://packagist.org/packages/iraq-laravel/phone)[ RSS](/packages/iraq-laravel-phone/feed)WikiDiscussions main Synced 1mo ago

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

iraq-laravel/phone
==================

[](#iraq-laravelphone)

[![iraq-laravel/phone](./cover.svg)](./cover.svg)

Iraqi phone number validation, operator detection, and E.164 normalization for Laravel.

[![Latest Version](https://camo.githubusercontent.com/83ec2cee6c63293b29ec616a6a925ef7ec31fdd7e2069c219a213ed7d03e1c3b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f697261712d6c61726176656c2f70686f6e652e737667)](https://packagist.org/packages/iraq-laravel/phone)[![Downloads](https://camo.githubusercontent.com/12052ccda1dd8734418beac3bd5c3bc6e61b23a6cba6979c17b32327f7001f3e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f697261712d6c61726176656c2f70686f6e652e737667)](https://packagist.org/packages/iraq-laravel/phone)[![Views](https://camo.githubusercontent.com/d7591b39d5195acf5e69a7826276ebfece0fabe0eb5851d458f15444667feb97/68747470733a2f2f6b6f6d617265762e636f6d2f67687076632f3f757365726e616d653d68616d7a61323030343131267265706f3d697261712d6c61726176656c2d70686f6e65267374796c653d666c61742d737175617265)](https://github.com/hamza200411/iraq-laravel-phone)[![Tests](https://github.com/hamza200411/iraq-laravel-phone/actions/workflows/tests.yml/badge.svg)](https://github.com/hamza200411/iraq-laravel-phone/actions)[![License](https://camo.githubusercontent.com/b8f4a3334400b0c89d4be9b8cbe0df917ac633c1649e303786ff783afc891086/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f68616d7a613230303431312f697261712d6c61726176656c2d70686f6e65)](LICENSE)

---

Features
--------

[](#features)

- Validate Iraqi mobile and landline numbers
- Detect operator: Zain, Asiacell, Korek, Alkafeel Omnnea
- Normalize any input format to E.164 (`+9647XXXXXXXXX`)
- Detect all verified governorate landline area codes (Arabic + English + Kurdish Sorani)
- Laravel validation rule — object-based and shorthand string
- Restrict validation to specific operators
- Zero external dependencies — pure PHP

---

Requirements
------------

[](#requirements)

- PHP 8.1+
- Laravel 10, 11, or 12

---

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

[](#installation)

```
composer require iraq-laravel/phone
```

The service provider and facade register automatically. No manual setup needed.

Optionally publish the config and translation strings:

```
php artisan vendor:publish --tag=iraqi-phone
```

You can also publish just the config using the legacy tag:

```
php artisan vendor:publish --tag=iraqi-phone-config
```

The package includes translations for English, Arabic, and Kurdish (Sorani). After publishing, edit them under `resources/lang/vendor/iraqi-phone/{locale}/validation.php`.

---

Quick start
-----------

[](#quick-start)

```
use IraqLaravel\Phone\Facades\IraqiPhone;

$phone = IraqiPhone::parse('0780 123 4567');

$phone->local;              // 07801234567
$phone->e164;               // +9647801234567
$phone->formatted();        // 0780 123 4567
$phone->prefix();           // 0780
$phone->subscriberNumber(); // 1234567
$phone->operator;           // Operator::Zain
$phone->operator->name();   // Zain Iraq
$phone->operator->label();  // زين العراق
$phone->isMobile;           // true
```

---

Accepted input formats
----------------------

[](#accepted-input-formats)

All of the following resolve to the same number:

```
07801234567
+9647801234567
009647801234567
9647801234567
0780 123 4567
0780-123-4567

```

---

Mobile operators
----------------

[](#mobile-operators)

OperatorPrefixesArabicZain Iraq0780–0789, 0790–0799زين العراقAsiacell0770–0779آسياسيلKorek Telecom0750–0759كورك تيليكومAlkafeel Omnnea0760–0769الكفيل أمنية> **Note:** Iraq has Mobile Number Portability (MNP). A prefix may not reflect the subscriber's current operator after porting.

---

Landline area codes
-------------------

[](#landline-area-codes)

All verified codes from the Iraqi national numbering plan.

Area codeCity / GovernorateArabic1Baghdadبغداد21Tikrit / Saladinتكريت / صلاح الدين23Kut / Wasitالكوت / واسط24Ramadi / Anbarالرمادي / الأنبار25Baquba / Diyalaبعقوبة / ديالى30Hillah / Babilالحلة / بابل32Karbalaكربلاء33Najafالنجف36Diwaniya / Al-Qadisiyyahالديوانية / القادسية37Samawa / Al-Muthannaالسماوة / المثنى40Basraالبصرة42Nasiriya / Dhi Qarالناصرية / ذي قار43Amara / Maysanالعمارة / ميسان50Kirkukكركوك53Sulaymaniyahالسليمانية60Mosul / Ninevehالموصل / نينوى62Duhokدهوك66Erbilأربيل67Halabjaحلبجة---

Validation
----------

[](#validation)

### Object-based rule (recommended)

[](#object-based-rule-recommended)

```
use IraqLaravel\Phone\Rules\IraqiPhoneNumber;
use IraqLaravel\Phone\Enums\Operator;

// Any valid Iraqi number
'phone' => ['required', new IraqiPhoneNumber()]

// Mobile only — rejects landlines
'phone' => ['required', new IraqiPhoneNumber(mobileOnly: true)]

// Restrict to specific operators
'phone' => ['required', new IraqiPhoneNumber(operators: [Operator::Zain, Operator::Asiacell])]
```

### Shorthand string rules

[](#shorthand-string-rules)

```
'phone' => 'required|iraqi_phone'    // any valid Iraqi number
'phone' => 'required|iraqi_mobile'   // mobile only
```

### Inside a Form Request

[](#inside-a-form-request)

```
use IraqLaravel\Phone\Rules\IraqiPhoneNumber;

class RegisterRequest extends FormRequest
{
    public function rules(): array
    {
        return [
            'name'  => ['required', 'string'],
            'phone' => ['required', new IraqiPhoneNumber(mobileOnly: true)],
        ];
    }
}
```

---

Landline parsing
----------------

[](#landline-parsing)

```
$phone = IraqiPhone::parse('060123456'); // Mosul landline

$phone->isMobile;    // false
$phone->areaName;    // "Mosul / Nineveh"
$phone->areaNameAr;  // "الموصل / نينوى"
$phone->areaNameKu;  // 'مووسڵ / نەینەوا' (Kurdish Sorani)
$phone->operator;    // Operator::Unknown
$phone->e164;        // +96460123456
```

---

`toArray()` — for API responses
-------------------------------

[](#toarray--for-api-responses)

```
IraqiPhone::parse('07801234567')->toArray();

// [
//   'raw'            => '07801234567',
//   'local'          => '07801234567',
//   'e164'           => '+9647801234567',
//   'formatted'      => '0780 123 4567',
//   'prefix'         => '0780',
//   'subscriber'     => '1234567',
//   'operator'                  => 'zain',
//   'operator_name'             => 'Zain Iraq',
//   'operator_label'            => 'زين العراق',
//   'operator_label_localized'  => 'Zain Iraq',
//   'is_mobile'                 => true,
//   'area_name'      => null,
//   'area_name_ar'   => null,
//   'area_name_ku'   => null,
// ]
```

---

Without the facade
------------------

[](#without-the-facade)

```
use IraqLaravel\Phone\IraqiPhone;

$service = new IraqiPhone();
$phone   = $service->parse('07801234567');
```

---

Exception handling
------------------

[](#exception-handling)

`parse()` throws `InvalidIraqiPhoneNumberException` for unrecognized input. Use `isValid()` to check first:

```
use IraqLaravel\Phone\Exceptions\InvalidIraqiPhoneNumberException;

if (IraqiPhone::isValid($input)) {
    $phone = IraqiPhone::parse($input);
}

// Or catch explicitly:
try {
    $phone = IraqiPhone::parse($input);
} catch (InvalidIraqiPhoneNumberException $e) {
    // handle error
}
```

---

Running tests
-------------

[](#running-tests)

```
composer install
./vendor/bin/phpunit
```

---

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

---

Author
------

[](#author)

[Hamza Mohammed](https://hamza-mohammed.me) · [hamza200411](https://github.com/hamza200411)

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance89

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

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

Unknown

Total

1

Last Release

54d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/49249ad722e45ff1eb5129d0db85a40b05809d3da30fb88cc6f68bbca5775252?d=identicon)[hamza200411](/maintainers/hamza200411)

---

Top Contributors

[![hamza200411](https://avatars.githubusercontent.com/u/132139779?v=4)](https://github.com/hamza200411 "hamza200411 (1 commits)")

---

Tags

laravelvalidationphoneiraqzainasiacellkorekalkafeel

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/iraq-laravel-phone/health.svg)

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

###  Alternatives

[propaganistas/laravel-phone

Adds phone number functionality to Laravel based on Google's libphonenumber API.

3.0k35.7M107](/packages/propaganistas-laravel-phone)[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[axlon/laravel-postal-code-validation

Worldwide postal code validation for Laravel and Lumen

3853.3M1](/packages/axlon-laravel-postal-code-validation)[wendelladriel/laravel-validated-dto

Data Transfer Objects with validation for Laravel applications

759569.4k13](/packages/wendelladriel-laravel-validated-dto)[laravel-validation-rules/credit-card

Validate credit card number, expiration date, cvc

2412.2M5](/packages/laravel-validation-rules-credit-card)[galahad/laravel-addressing

Laravel package providing addressing functionality

70316.6k](/packages/galahad-laravel-addressing)

PHPackages © 2026

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