soullessthread / laravel-perisan-name-gender-detection
Laravel integration for offline Persian given-name gender detection
Package info
github.com/soullessthread/laravel-perisan-name-gender-detection
pkg:composer/soullessthread/laravel-perisan-name-gender-detection
Requires
- php: >=8.1
- ext-mbstring: *
- ext-zlib: *
- illuminate/contracts: ^10.0 || ^11.0 || ^12.0
- illuminate/support: ^10.0 || ^11.0 || ^12.0
Requires (Dev)
- orchestra/testbench: ^8.0 || ^9.0 || ^10.0
- phpunit/phpunit: ^10.5 || ^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
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