SDKs
PHP
Idiomatic PHP patterns for the Thunderbit Open API
Use Guzzle. Composer install in one line; works on PHP 8.1+.
Install
composer require guzzlehttp/guzzleConfigure
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$api = new Client([
'base_uri' => 'https://openapi.thunderbit.com/openapi/v1/',
'headers' => [
'Authorization' => 'Bearer ' . getenv('THUNDERBIT_API_KEY'),
'Content-Type' => 'application/json',
],
'timeout' => 60,
]);Distill a page
$res = $api->post('distill', [
'json' => ['url' => 'https://thunderbit.com/playground'],
]);
$data = json_decode($res->getBody(), true);
echo $data['data']['markdown'];Extract structured data
$res = $api->post('extract', [
'json' => [
'url' => 'https://example.com/product/iphone-15-pro',
'schema' => [
'type' => 'object',
'properties' => [
'name' => ['type' => 'string'],
'price' => ['type' => 'number'],
],
'required' => ['name', 'price'],
],
],
]);
$data = json_decode($res->getBody(), true)['data'];Batch + webhook
$job = json_decode($api->post('batch/distill', [
'json' => [
'urls' => ['https://example.com/page1', 'https://example.com/page2'],
'webhook' => [
'url' => 'https://your-server.com/webhook',
'secret' => getenv('WEBHOOK_SECRET'),
],
],
])->getBody(), true);
error_log('Batch submitted: ' . $job['data']['id']);Verify the webhook signature in your handler — see Webhooks.
An official PHP SDK is in development — check back soon.