프로그래밍 언어별로 사용할 수 있는 라이브러리를 제공하나요?
우리 API는 구조가 아주 단순해서, jQuery 플러그인을 제외하고는 별도의 언어별 라이브러리를 제공하지 않아.
대부분의 프로그래밍 언어는 기본적으로 JSON 파서를 지원하고, 그렇지 않은 언어들도 이미 외부 라이브러리가 많이 있어.
API를 바로 써보고 싶다면, 아래의 코딩 예제를 참고해 시작해 봐
먼저 composer로 우리 라이브러리를 설치해 줘:
composer require gender-api/client
<?php
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
}
// First name with country (e.g., "Andrea" varies by country)
$result = $client->getByFirstNameAndCountry('Andrea', 'IT');
echo $result->getGender(); // "male" (in Italy)
// Full name with automatic first/last name splitting
$result = $client->getByFirstNameAndLastName('Sandra Miller');
echo $result->getFirstName(); // "Sandra"
echo $result->getLastName(); // "Miller"
echo $result->getGender(); // "female"
// Email address analysis
$result = $client->getByEmailAddress('elisabeth.smith@company.com');
echo $result->getGender(); // "female"
// Batch processing - multiple names in one call
$names = ['Michael', 'Sarah', 'Kim'];
$results = $client->getByMultipleNames($names);
foreach ($results as $result) {
printf(
"%s: %s (%d%% confidence)\n",
$result->getFirstName(),
$result->getGender(),
$result->getAccuracy()
);
}
전체 클라이언트 문서는 여기에서 확인해 줘:
연관 키워드
이 글이 도움이 되었어?