Search by

soullessthread / laravel-perisan-name-gender-detection

Laravel integration for offline Persian given-name gender detection

Maintainers

Package info

github.com/soullessthread/laravel-perisan-name-gender-detection

pkg:composer/soullessthread/laravel-perisan-name-gender-detection

Transparency log

Statistics

Installs: 4

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2026-08-29 12:33 UTC

This package is auto-updated.

Last update: 2026-08-29 12:49:32 UTC


README

An offline Laravel package for detecting the likely gender of Persian given names. It returns M, F, or null and ships with its own packed dictionary, so requests never leave your application.

Installation

Install the package from Packagist:

composer require soullessthread/laravel-perisan-name-gender-detection

Laravel discovers the service provider and facade automatically.

Usage

use PersianNameGender\LaravelPlugin\Detector;
use PersianNameGender\LaravelPlugin\Facades\Gender;

app(Detector::class)->gender('آرمان'); // 'M'
Gender::gender('فاطمه');               // 'F'
persian_gender('یارا');                // null

Use the validation rule when a field must resolve to a particular gender:

use PersianNameGender\LaravelPlugin\Rules\PersianGender;

$request->validate([
    'first_name' => ['required', 'string', new PersianGender('F')],
]);

To override the bundled dictionary, publish the config and set an absolute file path:

php artisan vendor:publish --tag=persian-name-gender-config
PERSIAN_NAME_GENDER_DICTIONARY=/absolute/path/to/g.bin

Development

composer install
composer test
composer test:smoke