2017 © Pedro Peláez
 

yii2-extension yii2-gender-api

Yii2 extension of Gender API

image

richweber/yii2-gender-api

Yii2 extension of Gender API

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 12 % Grown

The README.md

Yii2 Gender API

This extension provides the Gender API for the Yii framework 2.0., (*1)

Installation

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)

Configure

'components' => [
    ...
    'gender' => [
        'class' => 'richweber\gender\components\Gender',
        'serverKey' => '<your private server key>',
    ],
    ...
],

Basic Usage

/** @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);
}

As multiple names

$result = $component->checkName(['Roman', 'Богдан']);
if (!isset($result->errno)) {
    var_dump($result->result);
}

Localization by country

$result = $component->byLocalization('UA')->checkName('Roman');
if (!isset($result->errno) && $result->accuracy > 60) {
    $gender = (string) $result->gender;
    var_dump($gender);
}

Localization by IP

$result = $component->byIP('54.201.16.177')->checkName('Roman');
if (!isset($result->errno) && $result->accuracy > 60) {
    $gender = (string) $result->gender;
    var_dump($gender);
}

Localization by language

$result = $component->byLanguage('de-DE')->checkName('Roman');
if (!isset($result->errno) && $result->accuracy > 60) {
    $gender = (string) $result->gender;
    var_dump($gender);
}

Get gender by an email address

$result = $component->checkNameByEmail('markus.p@gmail.com');
if (!isset($result->errno) && $result->accuracy > 60) {
    $gender = (string) $result->gender;
    var_dump($gender);
}

The Versions

06/12 2016

dev-master

9999999-dev

Yii2 extension of Gender API

  Sources   Download

BSD-3-Clause

The Requires

 

api yii2 gender

06/12 2016

1.0.0

1.0.0.0

Yii2 extension of Gender API

  Sources   Download

BSD-3-Clause

The Requires

 

api yii2 gender

06/12 2016

0.1.0

0.1.0.0

Yii2 extension of Gender API

  Sources   Download

BSD-3-Clause

The Requires

 

api yii2 gender