hotrush/genderapi-client

Maintainers

Package info

github.com/hotrush/genderapi-client

pkg:composer/hotrush/genderapi-client

Statistics

Installs: 74 086

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.2 2019-06-26 12:33 UTC

This package is auto-updated.

Last update: 2026-02-27 03:42:45 UTC


README

PHP SDK for GenderApi.io API

Simple to use, api key is optional. See API docs here - https://genderapi.io/api-documentation

Installation

composer require hotrush/genderapi-client 

Usage

use Hotrush\GenderApi\GenderApiClient;
use Hotrush\GenderApi\Adapter\GuzzleHttpAdapter;

$client = new GenderApiClient(
    new GuzzleHttpAdapter($apiToken)
);

$nameData = $client->getGender($name, $countryCode);
echo $nameData->getGender();

$namesData = $client->getGendersBatch($namesArray, $countryCode);
foreach ($namesData as $nameData) {
    echo $nameData->getGender().PHP_EOL;
    echo $nameData->getName().PHP_EOL;
    echo $nameData->getProbability().PHP_EOL;
}

$nameData = $client->getGenderByEmail($name, $countryCode);
echo $nameData->getGender();