1. Go to this page and download the library: Download gender-api/client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gender-api / client example snippets
use GenderApi\Client as GenderApiClient;
$client = new GenderApiClient('your-api-key');
// Simple gender lookup
$result = $client->getByFirstName('Elisabeth');
if ($result->genderFound()) {
echo $result->getGender(); // "female"
echo $result->getAccuracy(); // 99
}
// In Italy, Andrea is typically male
$result = $client->getByFirstNameAndCountry('Andrea', 'IT');
echo $result->getGender(); // "male"
// In Germany, Andrea is typically female
$result = $client->getByFirstNameAndCountry('Andrea', 'DE');
echo $result->getGender(); // "female"
// Localize by IP address
$result = $client->getByFirstNameAndClientIpAddress('Jan', '178.27.52.144');
// Localize by browser locale
$result = $client->getByFirstNameAndLocale('Jan', 'de_DE');