承接 brstreet2/maskify 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

brstreet2/maskify

Composer 安装命令:

composer require brstreet2/maskify

包简介

A PHP package for masking strings with customizable visibility.

README 文档

README

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

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

  • 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

Install the package via Composer:

composer require brstreet2/maskify

Usage

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

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

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

Advanced Options

You can also mask a string completely:

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

Testing

Run tests to ensure everything is working as expected:

composer test

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

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

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固