PHPackages                             ssitu/bernardo - 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. [Localization &amp; i18n](/categories/localization)
4. /
5. ssitu/bernardo

ActiveLibrary[Localization &amp; i18n](/categories/localization)

ssitu/bernardo
==============

A loyal companion to format usernames, subdomains and validate them against blacklists.

v0.1.0(4y ago)03MITPHP

Since Jun 9Pushed 4y ago1 watchersCompare

[ Source](https://github.com/I-is-as-I-does/Bernardo)[ Packagist](https://packagist.org/packages/ssitu/bernardo)[ Docs](https://github.com/I-is-as-I-does/Bernardo)[ RSS](/packages/ssitu-bernardo/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Bernardo
========

[](#bernardo)

A loyal companion to format usernames, subdomains and validate them against blacklists.

Contains:

- a map for diacritics replacements;
- a long list of profanities and reserved words, in multiple languages;
- a PHP implementation.

A JS implementation may be coming up.
More translations of reserved words could be welcomed.

How to
------

[](#how-to)

Just use `src/bernardo-diacritics.json` or `src/bernardo-dictionnary.json` if you wish to!

Regarding PHP implementation:

```
$ composer require ssitu/bernardo
```

```
use SSITU\Bernardo;

require_once 'path/to/autoload.php';

$Bernardo = new Bernardo();
# OR
$adtDictionnary = ['qwibqwib','jeffkoons'];
$Bernardo = new Bernardo($adtDictionnary); // will be added to the default one

# All-in-one methods:

$Bernardo->isValidSubDomain($entry, $returnSuggestion = false, $strict = true, $minLen = 4, $maxLen = 20);
$Bernardo->isValidUsername($entry, $returnSuggestion = false, $strict = true, $minLen = 4, $maxLen = 20);

# Cherry-pick methods:

// These 4 methods will handle diacritics substitution:
$Bernardo->formatSubdomain($entry, $minLen = 4, $maxLen = 20);
$Bernardo->formatUsername($entry, $minLen = 4, $maxLen = 20);
$Bernardo->format($entry, $pattern, $toLower = false, $minLen = 4, $maxLen = 20);
$Bernardo->replaceDiacr($entry);

// For these 3, diacritics MUST have been handled beforehand (or expect possibly wrong returns):
$Bernardo->isValid($noDiacrEntry, $strict = true);
$Bernardo->strictExtractForbidden($noDiacrEntry, $stopAtFirst = false);
$Bernardo->extractForbidden($noDiacrEntry);

// Adjustements:
$Bernardo->cleanEntry($entry, $matches);
$Bernardo->forceLength($entry, $minLen = 4, $maxLen = 20);
```

You can also take a look at `src/php/Bernardo_test.php`.

### Too severe?

[](#too-severe)

I suggest to make easily accessible to your users a small, dedicated contact form, in case they feel the filter is too restrictive.

Credits
-------

[](#credits)

Rodrigo De Almeida Siqueira (ex-project: postbit.com)
[Subdomain Blacklist](https://github.com/michaldudek/subdomain-blacklist)
[Profanity](https://github.com/ConsoleTVs/Profanity)

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

[](#contributing)

Sure! 🙌 You can take a loot at [CONTRIBUTING](CONTRIBUTING.md).

License
-------

[](#license)

This project is under the MIT License; cf. [LICENSE](LICENSE) for details.

[![Gene Sheldon in the role of Bernardo](Bernardo.jpg)](Bernardo.jpg)

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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

1805d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0abf823fded25a054764d7b7106a69b4281ff506994ffe2fea00d8a9296e715a?d=identicon)[I-is-as-I-does](/maintainers/I-is-as-I-does)

---

Top Contributors

[![I-is-as-I-does](https://avatars.githubusercontent.com/u/66915011?v=4)](https://github.com/I-is-as-I-does "I-is-as-I-does (10 commits)")

---

Tags

blacklistsdiacriticsdictionaryi18njsonphpsubdomainusername-checkerphpjsonmaplistsubdomainutilsusername

### Embed Badge

![Health badge](/badges/ssitu-bernardo/health.svg)

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

###  Alternatives

[phootwork/collection

The phootwork library fills gaps in the php language and provides better solutions than the existing ones php offers.

3924.8M15](/packages/phootwork-collection)[codezero/laravel-localized-routes

A convenient way to set up, manage and use localized routes in a Laravel app.

543638.1k4](/packages/codezero-laravel-localized-routes)[laurentesc/laravel-subdomain-localization

Subdomain localization support for Laravel

1911.3k](/packages/laurentesc-laravel-subdomain-localization)[pharaonic/laravel-locations

Laravel - Countries\[States/Cities, Currency, Phone Code, Languages, Capital\] &amp; Continents &amp; Timezones.

102.4k1](/packages/pharaonic-laravel-locations)

PHPackages © 2026

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