Snoop finds informations about an email address owner such as its name, social profiles, images and jobs.
Add this line to your composer.json
file:
{
"require": {
"florianv/snoop": "~1.0"
}
}
Currently Guzzle 3 and 4 are supported HTTP clients, so you will need to require one of them:
"guzzle/guzzle": "~3.0"
"guzzlehttp/guzzle": "~4.0"
You can find a simple example using it here
First, you need to create an adapter:
// If you use Guzzle 3
$adapter = new \Snoop\Adapter\Guzzle3Adapter(new \Guzzle\Http\Client());
// If you use Guzzle 4
$adapter = new \Snoop\Adapter\Guzzle4Adapter(new \GuzzleHttp\Client());
Then you can create a Snoop instance and use it:
// Create a Snoop instance
$snoop = new \Snoop\Snoop($adapter);
// Find the person with email 'john@doe.com'
$person = $snoop->find('john@doe.com');
$person->getFirstName(); // John
$person->getLastName(); // Doe
$person->getLocation(); // San Francisco Bay Area
$person->getHeadline(); // Developer at Google
foreach ($person->getImages() as $url) {}
foreach ($person->getJobs() as $job) {
$job->getTitle(); // Developer
$job->getCompanyName(); // Google
}
foreach ($person->getProfiles() as $profile) {
$profile->getSiteName(); // Twitter
$profile->getUsername(); // johndoe
}
By default, two requests will be issued: one to get a token and the other to get the informations, but you can send them separately:
// Fetch a token, maybe store it somewhere
$token = $snoop->fetchToken();
// Find the informations using the token
$person = $snoop->find('hello@world.com', $token);
The InvalidTokenException
is thrown when the token is missing or invalid.
try {
$snoop->find('hello@world.com');
} catch (Snoop\Exception\InvalidTokenException $e) {
// You might fetch a new token and retry
}
The PersonNotFoundException
is thrown when there is no data associated with the email.
try {
$snoop->find('hello@world.com');
} catch (Snoop\Exception\PersonNotFoundException $e) {
// This person was not found
}