dev-master
9999999-devYii2 extension of Gender API
BSD-3-Clause
The Requires
by RichWeber
api yii2 gender
Yii2 extension of Gender API
This extension provides the Gender API for the Yii framework 2.0., (*1)
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require --prefer-dist richweber/yii2-gender-api
or add, (*4)
"richweber/yii2-gender-api": "^1.0.0"
to the require section of your composer.json, (*5)
'components' => [ ... 'gender' => [ 'class' => 'richweber\gender\components\Gender', 'serverKey' => '<your private server key>', ], ... ],
/** @var \richweber\gender\components\Gender $component */ $component = Yii::$app->gender; $result = $component->checkName('Roman'); if (!isset($result->errno) && $result->accuracy > 60) { $gender = (string) $result->gender; var_dump($gender); }
$result = $component->checkName(['Roman', 'Богдан']); if (!isset($result->errno)) { var_dump($result->result); }
$result = $component->byLocalization('UA')->checkName('Roman'); if (!isset($result->errno) && $result->accuracy > 60) { $gender = (string) $result->gender; var_dump($gender); }
$result = $component->byIP('54.201.16.177')->checkName('Roman'); if (!isset($result->errno) && $result->accuracy > 60) { $gender = (string) $result->gender; var_dump($gender); }
$result = $component->byLanguage('de-DE')->checkName('Roman'); if (!isset($result->errno) && $result->accuracy > 60) { $gender = (string) $result->gender; var_dump($gender); }
$result = $component->checkNameByEmail('markus.p@gmail.com'); if (!isset($result->errno) && $result->accuracy > 60) { $gender = (string) $result->gender; var_dump($gender); }
Yii2 extension of Gender API
BSD-3-Clause
api yii2 gender