PHPackages                             mozhuilungdsuo/universal-mask - 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. mozhuilungdsuo/universal-mask

ActiveLibrary

mozhuilungdsuo/universal-mask
=============================

A flexible Laravel masking utility for names, IDs, and phone numbers.

v1.0.0(2mo ago)112MITPHPPHP ^8.1

Since Mar 10Pushed 2mo agoCompare

[ Source](https://github.com/mozhuilungdsuo/universal-mask)[ Packagist](https://packagist.org/packages/mozhuilungdsuo/universal-mask)[ RSS](/packages/mozhuilungdsuo-universal-mask/feed)WikiDiscussions main Synced 1mo ago

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

Universal Mask for Laravel
==========================

[](#universal-mask-for-laravel)

A flexible, lightweight Laravel package to mask sensitive data like Names, Government IDs (Aadhaar, PAN), Phone numbers, and DOBs while keeping specific characters visible at the start and end.

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

[](#installation)

You can install the package via Composer:

```
composer require mozhuilungdsuo/universal-mask
```

Features
--------

[](#features)

- **Dynamic Blade Directive:** Use `@u_mask` directly in your views with custom parameters.
- **Global Helper Function:** Access `u_mask()` in Controllers, Models, or API Resources.
- **Multi-word Support:** Automatically detects spaces and masks each part of a full name individually (e.g., "John Doe" becomes "J\*\*n D\*e").
- **UTF-8 Support:** Uses Laravel's `Str` helpers to safely handle special characters and accents.

---

Usage
-----

[](#usage)

### 1. In Blade Views

[](#1-in-blade-views)

The directive allows you to specify how many characters to reveal at the start and end, and optionally change the mask character.

**Syntax:** `@u_mask($value, $showStart, $showEnd, $maskChar)`

Data TypeBlade DirectiveInputOutput**Standard Name**`@u_mask($name, 1, 1)``Alexander``A*******r`**Aadhaar / ID**`@u_mask($uid, 0, 4)``555566667777``********7777`**Phone Number**`@u_mask($phone, 2, 2)``9876543210``98******10`**Custom Char**`@u_mask($name, 1, 1, 'x')``John``Jxxn`### 2. In PHP / Controllers

[](#2-in-php--controllers)

Use the helper function for API responses or backend logic:

```
// Basic usage
$masked = u_mask('John Harrison', 1, 2); // Result: J*hn H******on

// Masking a phone number in a Controller
$phone = u_mask($user->phone, 0, 3); // Result: *******210
```

---

Parameters Reference
--------------------

[](#parameters-reference)

The `u_mask` function and directive accept the following arguments:

1. **`$value`** (string|null): The string you want to mask.
2. **`$showStart`** (int): Number of characters to remain visible at the beginning. (Default: `1`)
3. **`$showEnd`** (int): Number of characters to remain visible at the end. (Default: `1`)
4. **`$char`** (string): The character used for masking. (Default: `*`)

> **Note:** To prevent data corruption, if the total length of the string is less than or equal to the sum of `$showStart` + `$showEnd`, the package will return the original string unmasked.

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

[](#requirements)

- **PHP:** ^8.1
- **Laravel:** ^10.0, ^11.0, or ^12.0

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance87

Actively maintained with recent releases

Popularity10

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

64d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6372fbb59453de0c379e7e99663f75a624f87ae7136dbe57e857452d8e30fc8b?d=identicon)[mozhui](/maintainers/mozhui)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/mozhuilungdsuo-universal-mask/health.svg)

```
[![Health](https://phpackages.com/badges/mozhuilungdsuo-universal-mask/health.svg)](https://phpackages.com/packages/mozhuilungdsuo-universal-mask)
```

###  Alternatives

[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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