Looking to hire Laravel developers? Try LaraJobs

laravel-perisan-name-gender-detection maintained by soullessthread

Description
Laravel integration for offline Persian given-name gender detection
Last update
2026/08/29 14:33 (dev-main)
License
Links
Downloads
6

Comments
comments powered by Disqus

Laravel Persian Name Gender

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