PHPackages                             brstreet2/maskify - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. brstreet2/maskify

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

brstreet2/maskify
=================

A PHP package for masking strings with customizable visibility.

02PHP

Since May 11Pushed 1y ago1 watchersCompare

[ Source](https://github.com/brstreet2/maskify)[ Packagist](https://packagist.org/packages/brstreet2/maskify)[ RSS](/packages/brstreet2-maskify/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Maskify
=======

[](#maskify)

Maskify is a lightweight PHP library designed to mask sensitive parts of a string with customizable visibility. This is particularly useful when working with sensitive data such as phone numbers, email addresses, or credit card numbers, which often need to be partially hidden for security or compliance purposes.

---

Motivation
----------

[](#motivation)

As a backend developer, I’ve frequently encountered requests from frontend developers to return masked data in API responses. This inspired me to create a reusable and reliable solution that simplifies masking sensitive data without adding complexity to backend systems.

Some example use cases for Maskify:

- Masking user phone numbers or email addresses in API responses.
- Hiding sensitive information such as account numbers or credit card details.
- Masking data during logging or debugging to protect sensitive values.

---

Features
--------

[](#features)

- Mask any string with asterisks (`*`).
- Customize the number of visible characters at the start or end of the string.
- Lightweight and easy to integrate with any PHP project.

---

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

[](#installation)

Install the package via Composer:

```
composer require brstreet2/maskify
```

---

Usage
-----

[](#usage)

Here's how to use the Maskify package in your project:

### Basic Usage

[](#basic-usage)

```
use Brstreet2\Maskify\Services\Masker;

$masker = new Masker();

// Mask a phone number, keeping the last 4 digits visible
echo $masker->mask('1234567890', 4); // Output: ******7890
```

### Customizing Mask Length

[](#customizing-mask-length)

```
// Mask an email address, keeping the first 3 characters visible
echo $masker->mask('example@gmail.com', -3); // Output: exa***********.com
```

### Advanced Options

[](#advanced-options)

You can also mask a string completely:

```
echo $masker->mask('SensitiveData'); // Output: **************
```

---

Testing
-------

[](#testing)

Run tests to ensure everything is working as expected:

```
composer test
```

---

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

[](#contributing)

Contributions are welcome! If you have ideas for new features or improvements, feel free to open an issue or submit a pull request.

---

License
-------

[](#license)

This project is licensed under the MIT License. See the LICENSE file for details.

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/81a74029faee3489359606b3546aebd58c9e3615885d46775d7a16d1d4d68448?d=identicon)[brstreet2](/maintainers/brstreet2)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/brstreet2-maskify/health.svg)

```
[![Health](https://phpackages.com/badges/brstreet2-maskify/health.svg)](https://phpackages.com/packages/brstreet2-maskify)
```

PHPackages © 2026

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