scraper-apis / thomasnet-scraper
PHP Scraper library for fetching supplier data from the ThomasNet Suppliers using an Apify actor
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/scraper-apis/thomasnet-scraper
Requires
- php: ^8.3
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- laravel/pint: ^1.0
- pestphp/pest: ^4.0
- phpstan/phpstan: ^1.0
This package is auto-updated.
Last update: 2026-01-26 02:34:05 UTC
README
A PHP library for fetching supplier data from the ThomasNet Suppliers Database using the Apify ThomasNet Supplier actor. Returns fully typed DTOs for easy integration into your application.
Installation
composer require scraper-apis/thomasnet-scraper
Requirements
- PHP 8.3+
- Apify API token (get one here)
Quick Start
use ThomasNetScraper\Client; use ThomasNetScraper\SearchMode; $client = new Client('YOUR_APIFY_TOKEN'); // Search for valve manufacturers $suppliers = $client->search('valve manufacturer'); foreach ($suppliers as $supplier) { echo $supplier->name . ' - ' . $supplier->primaryPhone . PHP_EOL; }
Usage
Search by Product Category
$suppliers = $client->search('CNC machining', SearchMode::All);
Search by Company Name
$suppliers = $client->search('Siemens', SearchMode::Name, maxResults: 50);
Regional Search
use ThomasNetScraper\Area; $suppliers = $client->search( query: 'precision machining', mode: SearchMode::All, area: Area::Michigan, maxResults: 500 );
Working with Supplier Data
foreach ($suppliers as $supplier) { // Company info echo $supplier->name; echo $supplier->description; echo $supplier->yearFounded; echo $supplier->annualSales; // e.g., "$250 Mil. and over" echo $supplier->numberEmployees; // e.g., "1000+" // Contact echo $supplier->primaryPhone; echo $supplier->website; // Location echo $supplier->address->city; echo $supplier->address->state; echo $supplier->address->latitude; echo $supplier->address->longitude; // Certifications foreach ($supplier->certifications as $cert) { echo $cert->title; // e.g., "ISO 9001:2015" echo $cert->type; // e.g., "QUALITY" echo $cert->scope; } // Products foreach ($supplier->products as $product) { echo $product->name; echo $product->description; } // Personnel foreach ($supplier->personnel as $person) { echo $person->name; echo $person->title; } }
Filtering Results
// Filter for ISO 9001 certified suppliers $iso9001Suppliers = array_filter( $suppliers, fn($s) => $s->hasCertification('ISO 9001') ); // Filter by state $texasSuppliers = array_filter( $suppliers, fn($s) => $s->address->state === 'TX' ); // Filter by employee count $largeSuppliers = array_filter( $suppliers, fn($s) => $s->numberEmployees === '1000+' );
DTOs
Supplier
| Property | Type | Description |
|---|---|---|
tgramsId |
string | Unique identifier |
name |
string | Company name |
description |
?string | Company description |
type |
?string | Supplier type |
tier |
?string | ThomasNet tier |
yearFounded |
?int | Year established |
annualSales |
?string | Revenue range |
numberEmployees |
?string | Employee count range |
primaryPhone |
?string | Main phone number |
website |
?string | Company website |
logoUrl |
?string | Logo image URL |
address |
Address | Location details |
certifications |
Certification[] | Quality certifications |
products |
Product[] | Product catalog |
headings |
Heading[] | ThomasNet category headings |
personnel |
Person[] | Company contacts |
brands |
Brand[] | Brand names |
social |
SocialLink[] | Social media links |
videos |
Video[] | Company videos |
news |
NewsArticle[] | Press releases |
whitepapers |
Whitepaper[] | Technical documents |
isMultiLocation |
bool | Has multiple locations |
xometryVerified |
bool | Xometry verification status |
isClaimed |
bool | Profile claimed by company |
scrapedAt |
DateTimeImmutable | Data extraction timestamp |
Address
| Property | Type |
|---|---|
address1 |
?string |
address2 |
?string |
city |
?string |
state |
?string |
stateName |
?string |
zip |
?string |
country |
?string |
latitude |
?float |
longitude |
?float |
Certification
| Property | Type |
|---|---|
id |
int |
code |
string |
title |
string |
type |
string |
group |
?string |
scope |
?string |
imageUrl |
?string |
url |
?string |
date |
?string |
Area Codes
| Code | Region |
|---|---|
NA |
All (North America) |
NT |
Texas North |
GT |
Texas South |
CN |
California North |
CS |
California South |
DN |
New York Metro |
UN |
New York Upstate |
IL |
Illinois |
MI |
Michigan |
NO |
Ohio North |
SO |
Ohio South |
EP |
Pennsylvania East |
WP |
Pennsylvania West |
ON |
Ontario |
QC |
Quebec |
See Area enum for the complete list of 50+ regions.
Error Handling
use ThomasNetScraper\Exception\ApiException; use ThomasNetScraper\Exception\RateLimitException; use ThomasNetScraper\Exception\InvalidQueryException; try { $suppliers = $client->search('valve'); } catch (RateLimitException $e) { // Handle rate limiting sleep($e->retryAfter); } catch (ApiException $e) { // Handle API errors echo $e->getMessage(); }
Deduplication
When running multiple queries, use tgramsId as the unique key:
$allSuppliers = []; foreach (['valve', 'pump', 'fitting'] as $query) { foreach ($client->search($query) as $supplier) { $allSuppliers[$supplier->tgramsId] = $supplier; } } // $allSuppliers now contains unique suppliers only
License
MIT