scraper-apis/thomasnet-scraper
Composer 安装命令:
composer require scraper-apis/thomasnet-scraper
包简介
PHP Scraper library for fetching supplier data from the ThomasNet Suppliers using an Apify actor
README 文档
README
A PHP library for fetching supplier data from the ThomasNet Suppliers Database using the Apify ThomasNet Supplier Scraper. Returns fully typed DTOs for easy integration into your application. Safe, reliable and scalable.
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
scraper-apis/thomasnet-scraper 适用场景与选型建议
scraper-apis/thomasnet-scraper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 01 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 scraper-apis/thomasnet-scraper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 scraper-apis/thomasnet-scraper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 33
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-26