PHPackages                             tuqqu/gender-detector - 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. tuqqu/gender-detector

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

tuqqu/gender-detector
=====================

Get gender from first name

v0.5.2(2y ago)56365.3k—1.5%10[2 issues](https://github.com/tuqqu/gender-detector/issues)MITPHPPHP ^8.1

Since May 21Pushed 2y ago2 watchersCompare

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

READMEChangelog (3)Dependencies (3)Versions (9)Used By (0)

Gender Detector
---------------

[](#gender-detector)

Get the most likely gender associated with a first name using PHP.

This library utilizes data sourced from the `gender.c` project created by Jörg Michael ([details](https://autohotkey.com/board/topic/20260-gender-verification-by-forename-cmd-line-tool-db/%5D)).

### Installation

[](#installation)

Install it with Composer:

```
composer require tuqqu/gender-detector
```

### Usage

[](#usage)

The usage is straightforward:

```
$detector = new GenderDetector\GenderDetector();

$detector->getGender('Thomas');
// Gender::Male

$detector->getGender('Avery');
// Gender::Unisex
```

I18N is fully supported:

```
$detector->getGender('Geirþrúður');
// Gender::Female
```

You can also specify a country:

```
$detector->getGender('Robin');
// Gender::MostlyMale

$detector->getGender('Robin', 'US');
// Gender::MostlyFemale

$detector->getGender('Robin', 'FR');
// Gender::Male

$detector->getGender('Robin', 'IE');
// Gender::Unisex
```

Country codes are case-insensitive ISO 3166-1 alpha-2 codes. Alternatively, you can utilize enum values; the complete list of values and codes can be found [here](/src/Country.php).

Full list of all the possible gender values are:

```
enum Gender
{
    case Male;
    case MostlyMale;
    case Female;
    case MostlyFemale;
    case Unisex;
}
```

For an unknown name it will return `null`.

If you have an alternative data file, you can pass it as the first argument to the `GenderDetector` constructor. Additionally, you can add new dictionary files using the `addDictionaryFile(string $path)` method:

```
$detector = new GenderDetector('custom_file_path/dict.txt');
$detector->addDictionaryFile('custom_file_path/another_dict.txt');
```

Note that each `GenderDetector` instantiation triggers file parsing, so you might want to avoid reading the same file twice.

### Licenses

[](#licenses)

The `GenderDetector` is licensed under the MIT License.

The data file `data/nam_dict.txt` is licensed under the GNU Free Documentation License.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity49

Moderate usage in the ecosystem

Community14

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 96.7% 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 ~223 days

Recently: every ~140 days

Total

8

Last Release

987d ago

PHP version history (3 changes)v0.1PHP ^7.2

v0.3PHP &gt;=7.4

v0.5PHP ^8.1

### Community

Maintainers

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

---

Top Contributors

[![tuqqu](https://avatars.githubusercontent.com/u/47274443?v=4)](https://github.com/tuqqu "tuqqu (29 commits)")[![raebbar](https://avatars.githubusercontent.com/u/5063463?v=4)](https://github.com/raebbar "raebbar (1 commits)")

---

Tags

gender-detectiongender-from-namegender-recognitionname

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tuqqu-gender-detector/health.svg)

```
[![Health](https://phpackages.com/badges/tuqqu-gender-detector/health.svg)](https://phpackages.com/packages/tuqqu-gender-detector)
```

###  Alternatives

[tormjens/eventy

The WordPress filter/action system in Laravel

438912.9k16](/packages/tormjens-eventy)[symfonycasts/tailwind-bundle

Delightful Tailwind Support for Symfony + AssetMapper

1091.3M17](/packages/symfonycasts-tailwind-bundle)[kphoen/sitemap-bundle

Provides a way to create/generate a sitemap using Doctrine, etc.

2444.8k](/packages/kphoen-sitemap-bundle)

PHPackages © 2026

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