PHPackages                             dominik-eller/laravel-data-normalizer - 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. dominik-eller/laravel-data-normalizer

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

dominik-eller/laravel-data-normalizer
=====================================

A Laravel package to normalize and format data such as phone numbers, emails, and other input into standardized formats.

v1.2.1(11mo ago)0482↓50%[3 PRs](https://github.com/dominik-eller/laravel-data-normalizer/pulls)MITPHPPHP ^8.2CI passing

Since Sep 25Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/dominik-eller/laravel-data-normalizer)[ Packagist](https://packagist.org/packages/dominik-eller/laravel-data-normalizer)[ Docs](https://github.com/dominik-eller/laravel-data-normalizer)[ GitHub Sponsors](https://github.com/dominik-eller)[ RSS](/packages/dominik-eller-laravel-data-normalizer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (14)Versions (9)Used By (0)

A Laravel package to normalize and format data such as phone numbers, emails, and other input into standardized formats.
========================================================================================================================

[](#a-laravel-package-to-normalize-and-format-data-such-as-phone-numbers-emails-and-other-input-into-standardized-formats)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2f8e6823f6106b4cee9b3789f1ddecebbad65fbf8462d2acbc9f7573338da8df/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646f6d696e696b2d656c6c65722f6c61726176656c2d646174612d6e6f726d616c697a65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dominik-eller/laravel-data-normalizer)[![GitHub Tests Action Status](https://camo.githubusercontent.com/b57db28c1e6ff28424b1536b5759fecd60bfeece694102c95ff831fa9f9198bb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f646f6d696e696b2d656c6c65722f6c61726176656c2d646174612d6e6f726d616c697a65722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/dominik-eller/laravel-data-normalizer/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/d4c58736806cb3960611582bcdf915a4b7339da26f970ab70471a8de64fa5157/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f646f6d696e696b2d656c6c65722f6c61726176656c2d646174612d6e6f726d616c697a65722f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/dominik-eller/laravel-data-normalizer/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/609c8e0913e90a9f36f2b3afd3da8f95cd97aa38186856e427c0093517ff6f18/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646f6d696e696b2d656c6c65722f6c61726176656c2d646174612d6e6f726d616c697a65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dominik-eller/laravel-data-normalizer)

A Laravel package to normalize and format data such as phone numbers, emails, and other input into standardized formats.

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

[](#installation)

You can install the package via composer:

```
composer require dominik-eller/laravel-data-normalizer
composer dump-autoload
```

You can publish the config file with:

```
php artisan vendor:publish --tag="data-normalizer-config"
```

This is the contents of the published config file:

```
return [
    'phone' => [
        'default_country' => 'DE',
        'format' => 'E164',
    ],
    'email' => [
        'trim_whitespace' => true,
        'lowercase' => true,
    ],
];
```

Usage
-----

[](#usage)

### Normalize a phone number

[](#normalize-a-phone-number)

```
use Deller\DataNormalizer\Facades\DataNormalizer;

$normalizedPhone = DataNormalizer::create('phone')->normalize('+49 (151) 123 45678');
// $normalizedPhone will be "+4915112345678" (E.164 format)
```

### Format a phone number

[](#format-a-phone-number)

```
use Deller\DataNormalizer\Facades\DataFormatter;

$formattedPhone = DataFormatter::create('phone')->format('+4915112345678', ['format' => 'INTERNATIONAL']);
// $formattedPhone will be "+49 151 1234 5678"
```

If parsing fails, the formatter logs the error and returns the original value.

### Normalize an email address

[](#normalize-an-email-address)

```
use Deller\DataNormalizer\Facades\DataNormalizer;

$normalizedEmail = DataNormalizer::create('email')->normalize('  JohnDoe@Example.com  ');
// $normalizedEmail will be "johndoe@example.com"
```

### Format an email address

[](#format-an-email-address)

```
use Deller\DataNormalizer\Facades\DataFormatter;

$formattedEmail = DataFormatter::create('email')->format('  JohnDoe@Example.com  ');
// $formattedEmail will be "johndoe@example.com"
```

### Registering a custom formatter

[](#registering-a-custom-formatter)

```
use Deller\DataNormalizer\Factories\DataFormatterFactory;

class CustomFormatter extends \Deller\DataNormalizer\DataFormatter
{
    public function format($data)
    {
        return 'Formatted: ' . strtoupper($data);
    }
}

// Register the custom formatter type
DataFormatterFactory::registerType('custom', CustomFormatter::class);

// Use the custom formatter via the facade
$customFormatter = \Deller\DataNormalizer\Facades\DataFormatter::create('custom');
echo $customFormatter->format('some data'); // Output: "Formatted: SOME DATA"
```

### Registering a custom normalizer

[](#registering-a-custom-normalizer)

```
use Deller\DataNormalizer\Factories\DataNormalizerFactory;

class CustomNormalizer extends \Deller\DataNormalizer\DataNormalizer
{
    public function normalize($data)
    {
        return 'Normalized: ' . strtolower(trim($data));
    }
}

// Register the custom normalizer type
DataNormalizerFactory::registerType('custom', CustomNormalizer::class);

// Use the custom normalizer via the facade
$customNormalizer = \Deller\DataNormalizer\Facades\DataNormalizer::create('custom');
echo $customNormalizer->normalize('  SOME DATA  '); // Output: "Normalized: some data"
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please report security vulnerabilities by email to  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Dominik Eller](https://github.com/dominik-eller)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance73

Regular maintenance activity

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 78.6% 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 ~65 days

Total

5

Last Release

334d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a2ccd4567291f7dd72eeb47c4ef636c3a4654f4911e92760573dad612299954?d=identicon)[dominik-eller](/maintainers/dominik-eller)

---

Top Contributors

[![dominik-eller](https://avatars.githubusercontent.com/u/12881106?v=4)](https://github.com/dominik-eller "dominik-eller (44 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (7 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (5 commits)")

---

Tags

laravelDominik Ellerlaravel-data-normalizer

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/dominik-eller-laravel-data-normalizer/health.svg)

```
[![Health](https://phpackages.com/badges/dominik-eller-laravel-data-normalizer/health.svg)](https://phpackages.com/packages/dominik-eller-laravel-data-normalizer)
```

###  Alternatives

[axlon/laravel-postal-code-validation

Worldwide postal code validation for Laravel and Lumen

3853.3M1](/packages/axlon-laravel-postal-code-validation)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[ziming/laravel-zxcvbn

Zxcvbn Password validation rule for Laravel

3056.7k](/packages/ziming-laravel-zxcvbn)[laravel-validation-rules/phone

Validate that a phone number is in the correct format

69355.5k](/packages/laravel-validation-rules-phone)[basillangevin/laravel-data-json-schemas

Transforms Spatie Data objects into JSON Schemas with built-in validation

1312.2k1](/packages/basillangevin-laravel-data-json-schemas)[yorcreative/laravel-argonaut-dto

Argonaut is a lightweight Data Transfer Object (DTO) package for Laravel that supports nested casting, recursive serialization, and validation out of the box. Ideal for service layers, APIs, and clean architecture workflows.

1062.8k1](/packages/yorcreative-laravel-argonaut-dto)

PHPackages © 2026

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