Skip to content

Releases: retab-dev/retab-php

v0.1.0 — Initial release

Choose a tag to compare

@sacha-ichbiah sacha-ichbiah released this 23 May 10:44

First public release of the official Retab PHP SDK.

composer require retab/retab

Highlights

  • 613-file PSR-4 package under the Retab\ namespace, generated from the Retab OpenAPI spec
  • Retab\Client top-level client with per-resource accessors (extractions(), schemas(), workflows(), ...)
  • Retab\Resource\* readonly models (PHP 8.2 idiom) with JsonSerializable + fromArray() / toArray()
  • Native PHP 8.1 enums for spec enum types
  • Retab\PaginatedResponse for cursor pagination (IteratorAggregate + explicit nextPage() walk)
  • Ergonomic MimeData input via Retab\Resource\MimeDataCoerce::coerce() — accepts SplFileInfo, path string, URL, open stream, array, or pre-built MimeData
  • PHPStan level 6 clean across the full lib/ tree
  • Hand-authored MimeData smoke suite: 10 tests, 18 assertions

Quick start

use Retab\Client;

\$client = new Client(apiKey: getenv('RETAB_API_KEY'));

\$response = \$client->extractions()->create(
    document: __DIR__ . '/invoice.pdf',
    jsonSchema: [
        'type' => 'object',
        'properties' => [
            'invoice_number' => ['type' => 'string'],
            'total' => ['type' => 'number'],
        ],
    ],
);

Requirements

  • PHP 8.2+
  • Guzzle 7

See the README for more.