jeffersongoncalves / laravel-clearbit
PHP/Laravel client for the Clearbit REST API: person enrichment, company enrichment, combined lookup, IP reveal, name-to-domain, and prospector search.
Package info
github.com/jeffersongoncalves/laravel-clearbit
pkg:composer/jeffersongoncalves/laravel-clearbit
Fund package maintenance!
Requires
- php: ^8.2
- illuminate/http: ^12.0|^13.0
- illuminate/support: ^12.0|^13.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.21
- orchestra/testbench: ^10.0|^11.0
- pestphp/pest: ^3.0|^4.0
- pestphp/pest-plugin-laravel: ^3.0|^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Laravel Clearbit
A PHP/Laravel client for the Clearbit REST APIs. Covers person enrichment, company enrichment, combined lookup, IP reveal, name-to-domain, and prospector search through a simple, typed API built on Laravel's Http client.
Features
- Person: enrich by email (
/v2/people/find) - Company: enrich by domain (
/v2/companies/find) - Combined: person + company in one call by email (
/v2/combined/find) - Reveal: identify a company from an IP address (
/v1/companies/find) - Name to Domain: resolve a company name to its domain (
/v1/domains/find) - Prospector: search for people at a company by role/seniority/title (
/v1/people/search) - Throws
ClearbitException(with the original API error body) on any non-2xx response - Throws
InvalidArgumentExceptionbefore hitting the API when required criteria are missing
Installation
You can install the package via composer:
composer require jeffersongoncalves/laravel-clearbit
Publish the config file:
php artisan vendor:publish --tag=clearbit-config
Set your Clearbit API key in .env:
CLEARBIT_API_KEY=your-api-key
Find it under Settings > API in your Clearbit dashboard.
Configuration
// config/clearbit.php return [ 'api_key' => env('CLEARBIT_API_KEY', ''), ];
Usage
The package is resolved via the Clearbit facade or by injecting JeffersonGoncalves\Clearbit\Clearbit. Each resource is exposed as a method returning a dedicated resource class.
Person
use JeffersonGoncalves\Clearbit\Facades\Clearbit; $person = Clearbit::person()->find('jane@example.com');
Company
$company = Clearbit::company()->find('example.com');
Combined
$combined = Clearbit::combined()->find('jane@example.com'); // $combined['person'], $combined['company']
Reveal
$company = Clearbit::reveal()->find('1.2.3.4');
Name to Domain
$result = Clearbit::nameToDomain()->find('Example Inc.'); // $result['domain']
Prospector
$people = Clearbit::prospector()->search('example.com', [ 'role' => 'engineering', 'seniority' => 'senior', 'title' => 'Engineer', 'page' => 1, 'page_size' => 10, ]);
Error handling
Any non-2xx API response throws JeffersonGoncalves\Clearbit\Exceptions\ClearbitException, which exposes the decoded error body:
use JeffersonGoncalves\Clearbit\Exceptions\ClearbitException; try { Clearbit::person()->find('unknown@example.com'); } catch (ClearbitException $e) { logger()->error($e->getMessage(), $e->errorBody()); }
Missing required criteria (an empty email, domain, ip, or name argument) throw InvalidArgumentException before any HTTP call is made.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
