PHPackages                             aleksandro-del-piero/validate-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. aleksandro-del-piero/validate-phone

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

aleksandro-del-piero/validate-phone
===================================

Package for validation phone number

1.0.0(2y ago)03MITPHP

Since Dec 10Pushed 2y ago1 watchersCompare

[ Source](https://github.com/aleksandro-del-piero/validate-phone)[ Packagist](https://packagist.org/packages/aleksandro-del-piero/validate-phone)[ RSS](/packages/aleksandro-del-piero-validate-phone/feed)WikiDiscussions master Synced yesterday

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

Package for validation of mobile phones for Laravel
===================================================

[](#package-for-validation-of-mobile-phones-for-laravel)

With the help of this package, you can validate a mobile phone number.

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

[](#installation)

You can install the package via composer:

```
composer require aleksandro_del_piero/validate_phone
```

Publish configuration file (optional). This command will publish a configuration file in your application. After that, you will be able to find the configuration file in the directory config/validate\_phone.php:

```
php artisan vendor:publish --provider="AleksandroDelPiero\ValidatePhone\ValidatePhoneServiceProvider" --tag="config"
```

Documentation
-------------

[](#documentation)

#### Using validation form requests:

[](#using-validation-form-requests)

Create a validation file following the example:

```
php artisan make:request ValidatePhoneFormRequest
```

In the created file, edit the validation rules:

```
    public function rules(): array
    {
        return [
            'phone' => ['validate_phone']
        ];
    }
```

or with using rule file:

```
use AleksandroDelPiero\ValidatePhone\Rules\ValidatePhoneRule;

    public function rules(): array
    {
        return [
            'phone' => [new ValidatePhoneRule(__('validation.validate_phone'))]
        ];
    }
```

In the translation file you must add a translation that will be used when a validation error occurs (by default path: lang/en/validation.php):

```
validation.php

    return [
    ...
     'validate_phone' => 'my custom message for phone validation',
    ...
    ]
```

#### Using validation in controller.

[](#using-validation-in-controller)

```
namespace App\Http\Controllers;

use Illuminate\Http\Request;

class TestController extends Controller
{
    /**
     * Store a newly created resource in storage.
     */
    public function store(Request $request)
    {
        $this->validate($request, [
            'phone' => ['validate_phone']
        ]);
    }
```

or with using rule file:

```
namespace App\Http\Controllers;

use AleksandroDelPiero\ValidatePhone\Rules\ValidatePhoneRule;
use Illuminate\Http\Request;

class TestController extends Controller
{
    /**
     * Store a newly created resource in storage.
     */
    public function store(Request $request)
    {
        $this->validate($request, [
            'phone' => [new ValidatePhoneRule(__('validation.validate_phone'))]
        ]);
    }
```

### Change the validation rules.

[](#change-the-validation-rules)

If you want to change the validation rules, you can do this in the published configuration file along the path 'config/validate\_phone.php'

```
return [
    'regular_expression' => '/^[\+]380(39|50|6[3|6-8]|9[1-9])[0-9]{7}$/'
];
```

After changing the configuration file, it is advisable to run the command to clear the cache:

```
php artisan optimize:clear
```

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

Popularity3

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

Unknown

Total

1

Last Release

936d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/251c6184057037d957cd699a3b0217c8ee4c18adc55c6fc1cf3f546a94805658?d=identicon)[aleksandro-del-piero](/maintainers/aleksandro-del-piero)

---

Top Contributors

[![aleksandro-del-piero](https://avatars.githubusercontent.com/u/57940924?v=4)](https://github.com/aleksandro-del-piero "aleksandro-del-piero (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aleksandro-del-piero-validate-phone/health.svg)

```
[![Health](https://phpackages.com/badges/aleksandro-del-piero-validate-phone/health.svg)](https://phpackages.com/packages/aleksandro-del-piero-validate-phone)
```

###  Alternatives

[marcosh/php-validation-dsl

A DSL for validating data in a functional fashion

483.9k](/packages/marcosh-php-validation-dsl)

PHPackages © 2026

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