PHPackages                             dennobaby/censor - 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. dennobaby/censor

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

dennobaby/censor
================

Simple PHP-lib to censor sensible data

1.0.2(4y ago)051MITPHPPHP ^7.3

Since Nov 2Pushed 4y ago1 watchersCompare

[ Source](https://github.com/dennobaby/censor)[ Packagist](https://packagist.org/packages/dennobaby/censor)[ RSS](/packages/dennobaby-censor/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (6)Dependencies (1)Versions (7)Used By (0)

[![Tests](https://github.com/dennobaby/censor/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/dennobaby/censor/actions/workflows/tests.yml)

censor
======

[](#censor)

Simple PHP-lib to censor sensible data

Usage
-----

[](#usage)

```
use Denno\Censor\Censor;

$censored = Censor::censor($string, ...$positions)
 // or
$censored = Censor::censorOnStrategy($string, Strategy::class);
```

Strategies
----------

[](#strategies)

Censor comes up with defined strategies for common data-types like IBAN, Phonenumbers,

### IBAN

[](#iban)

This strategy is useful to censor bank-accounts in IBAN-Format.

#### Examples

[](#examples)

- DE89 3704 0044 0532 0130 00 =&gt; DE\*\*37040044053201\*\*\*\*
- NL91 ABNA 0417 1643 00 =&gt; NL\*\*ABNA041716\*\*\*\*

### Phone-Numbers

[](#phone-numbers)

This strategy is useful to censor phone-numbers including area codes.

#### Examples

[](#examples-1)

- +4915226215421 =&gt; +4915226215\*\*\*

For short phone-numbers you should use the phone-short-strategy which censors the last half:

- 300452 =&gt; 300\*\*\*

### E-Mail

[](#e-mail)

Simply censor parts from the username and the domain

#### Examples:

[](#examples-2)

-  =&gt; den\*\*\*@doubl\*\*\*.it
-  =&gt; da\*@ao\*.local

### Person-Name

[](#person-name)

Censor a Person-name

#### Examples:

[](#examples-3)

- Miller &amp; Justice =&gt; Mil\*\*\* &amp; Just\*\*\*
- Jonathan Earl Of Northumbria =&gt; Jonat\*\*\* Ear\* O\* Northumb\*\*\*
- Jon Doe =&gt; Jo\* Do\*

Custom censoring
----------------

[](#custom-censoring)

Define your own censoring schema by using directly the censor-function. The first parameter is your string, the second is a variable number of positions, where up to the first position is censored, up to the second not, and so on.

Custom strategies
-----------------

[](#custom-strategies)

You can write your own Strategy implementing StrategyInterface to define patterns Censor should use.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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

Every ~0 days

Total

6

Last Release

1655d ago

Major Versions

0.1.2 → 1.0.02021-11-04

### Community

Maintainers

![](https://www.gravatar.com/avatar/b4e5bf08215a23bc1b134b1a855bad318a40da3a7406ffa7128219f022916830?d=identicon)[dennobaby](/maintainers/dennobaby)

---

Top Contributors

[![dennobaby](https://avatars.githubusercontent.com/u/5390491?v=4)](https://github.com/dennobaby "dennobaby (15 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dennobaby-censor/health.svg)

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

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

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