hotrush / genderapi-client
Installs: 70 431
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- ext-json: *
Requires (Dev)
- guzzlehttp/guzzle: ^6.3
- phpunit/phpunit: ^5.7
Suggests
- guzzlehttp/guzzle: To use GuzzleHttpAdapter, require guzzlehttp/guzzle:^6.0
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();