hotrush/genderapi-client

0.1.2 2019-06-26 12:33 UTC

This package is auto-updated.

Last update: 2024-11-27 00:36:06 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();