PHPackages                             immitranslate/datalab-sdk-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. immitranslate/datalab-sdk-laravel

ActiveLibrary[API Development](/categories/api)

immitranslate/datalab-sdk-laravel
=================================

Laravel SDK for Datalab API

v1.1.0(1mo ago)1356↓89%[1 PRs](https://github.com/immitranslate/datalab-sdk-laravel/pulls)MITPHPPHP ^8.3CI passing

Since Feb 14Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/immitranslate/datalab-sdk-laravel)[ Packagist](https://packagist.org/packages/immitranslate/datalab-sdk-laravel)[ Docs](https://github.com/immitranslate/datalab-sdk-laravel)[ GitHub Sponsors](https://github.com/ImmiTranslate)[ RSS](/packages/immitranslate-datalab-sdk-laravel/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (2)Dependencies (28)Versions (6)Used By (0)

Laravel SDK for Datalab API
===========================

[](#laravel-sdk-for-datalab-api)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e4b1cf0f9ea9f307f22ba6b8d83a554e526122a64b4e9f1bb7ef3159aa55b9bc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696d6d697472616e736c6174652f646174616c61622d73646b2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/immitranslate/datalab-sdk-laravel)[![GitHub Tests Action Status](https://camo.githubusercontent.com/13d964c2af725f6078b16fc1fb6d9bc3c22f82dcc2a50a8a385e8597e69c0b8f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f696d6d697472616e736c6174652f646174616c61622d73646b2d6c61726176656c2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/immitranslate/datalab-sdk-laravel/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/c13d47f8596ac45108fec58d21444c99d808cfd518407e53de8335b8c0ee78d8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f696d6d697472616e736c6174652f646174616c61622d73646b2d6c61726176656c2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/immitranslate/datalab-sdk-laravel/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/f4fbfd0d880d8fbdacce5c0a8f292234021fe5b0156a9aaf795c35d84ba2d3a2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696d6d697472616e736c6174652f646174616c61622d73646b2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/immitranslate/datalab-sdk-laravel)

To obtain an API key for Datalab, go to the [API keys](https://www.datalab.to/app/keys) page once you've created an account.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require immitranslate/datalab-sdk-laravel
```

You can publish the config file with:

```
php artisan vendor:publish --tag="datalab-sdk-laravel-config"
```

Usage
-----

[](#usage)

### Convert API

[](#convert-api)

```
use ImmiTranslate\Datalab\Enums\DatalabExtra;
use ImmiTranslate\Datalab\Enums\DatalabMode;
use ImmiTranslate\Datalab\Enums\DatalabOutput;
use ImmiTranslate\Datalab\Facades\Datalab;

$response = Datalab::convert()
    ->fileUrl('https://r2.aws.com/test.pdf') // or ->file('/absolute/path/to/document.pdf')
    ->mode(DatalabMode::Fast)
    ->outputFormats(DatalabOutput::Markdown, DatalabOutput::Json)
    ->extras([DatalabExtra::ExtractLinks, DatalabExtra::ChartUnderstanding]) // optional feature flags
    ->tokenEfficientMarkdown() // optional; compact markdown for LLM usage
    ->saveCheckpoint() // optional; checkpoint_id can be reused by /extract or /segment
    ->webhookUrl('https://testwebhook.com/test123') // optional; overrides account-level webhook for this request
    ->execute(); // alias of executeSync(), polls /convert/{request_id}

if ($response->isSuccess()) {
    // $response->markdown, $response->html, $response->json, $response->chunks
    // $response->checkpointId when saveCheckpoint() was used
}

// If you only want the initial request_id response (no polling):
$queued = Datalab::convert()->executeAsync();
// $queued->requestId, $queued->requestCheckUrl, $queued->isValidationError()
```

> **File limits:** maximum file size is 200 MB, with up to 7,000 pages per request. Results are deleted from Datalab servers one hour after processing completes — retrieve them promptly.

#### Convert with high accuracy

[](#convert-with-high-accuracy)

```
$result = Datalab::convert()
    ->file('/absolute/path/to/complex_document.pdf')
    ->mode(DatalabMode::Accurate)
    ->execute();

echo $result->parseQualityScore; // 0-5
echo $result->markdown;
```

#### Quality gates with the parse quality score

[](#quality-gates-with-the-parse-quality-score)

Every conversion includes a `parseQualityScore` (0-5), exposed alongside a `parseQuality` enum band (`Excellent` 4.0-5.0, `Good` 3.0-3.9, `Fair` 2.0-2.9, `Poor` 0.0-1.9):

```
use ImmiTranslate\Datalab\Enums\DatalabParseQuality;

$result = Datalab::convert()
    ->file('/absolute/path/to/document.pdf')
    ->mode(DatalabMode::Balanced)
    ->execute();

if (in_array($result->parseQuality, [DatalabParseQuality::Fair, DatalabParseQuality::Poor], true)) {
    // Retry with higher accuracy
    $result = Datalab::convert()
        ->file('/absolute/path/to/document.pdf')
        ->mode(DatalabMode::Accurate)
        ->execute();
}

$result->parseQuality?->recommendedAction(); // e.g. "Use the output directly"
```

#### HTML with block IDs for citations

[](#html-with-block-ids-for-citations)

```
$result = Datalab::convert()
    ->fileUrl('https://example.com/document.pdf')
    ->outputFormat(DatalabOutput::Html)
    ->addBlockIds()
    ->execute();
// HTML elements carry data-block-id attributes for citation tracking
```

#### Bounding box add-ons

[](#bounding-box-add-ons)

Billed at $0.30 per 1K pages each; require the `html` output format and also enable word bboxes:

```
$result = Datalab::convert()
    ->file('/absolute/path/to/document.pdf')
    ->outputFormat(DatalabOutput::Html)
    ->extras([DatalabExtra::TableCellBboxes, DatalabExtra::ListItemBboxes])
    ->execute();
// HTML contains data-bbox and data-confidence on table cells, list items, and words
```

#### Process specific pages (or spreadsheet sheets)

[](#process-specific-pages-or-spreadsheet-sheets)

```
$result = Datalab::convert()
    ->file('/absolute/path/to/large_document.pdf')
    ->pageRange('0-4,10,15-20') // pages 0-4, 10, and 15-20 (0-indexed)
    ->execute();

// For spreadsheet files, pageRange() filters by sheet index (0-based):
$sheets = Datalab::convert()
    ->file('/absolute/path/to/workbook.xlsx')
    ->pageRange('0,2') // first and third sheets only
    ->execute();
```

#### Extract track changes from Word documents

[](#extract-track-changes-from-word-documents)

```
$result = Datalab::convert()
    ->file('/absolute/path/to/document_with_changes.docx')
    ->extras(DatalabExtra::TrackChanges)
    ->outputFormat(DatalabOutput::Json)
    ->execute();
```

#### Additional config

[](#additional-config)

```
$result = Datalab::convert()
    ->file('/absolute/path/to/workbook.xlsx')
    ->additionalConfig([
        'keep_spreadsheet_formatting' => true,
        'keep_pageheader_in_output' => false,
    ])
    ->execute();
```

#### Checkpoints

[](#checkpoints)

Save a processing checkpoint to reuse parsed results without re-processing:

```
// Step 1: convert and save a checkpoint
$result = Datalab::convert()
    ->file('/absolute/path/to/document.pdf')
    ->saveCheckpoint()
    ->execute();

// Step 2: reuse the parsed document, e.g. for schema generation
$schemas = Datalab::generateSchemas()
    ->checkpoint($result->checkpointId)
    ->generate();
```

### Marker API

[](#marker-api)

> **Deprecated:** Datalab is deprecating the Marker API. Use the [Convert API](#convert-api) instead.

```
use ImmiTranslate\Datalab\Enums\DatalabMode;
use ImmiTranslate\Datalab\Enums\DatalabOutput;
use ImmiTranslate\Datalab\Facades\Datalab;
use ImmiTranslate\Datalab\FormField;

$response = Datalab::marker()
    ->fileUrl('https://r2.aws.com/test.pdf')
    ->mode(DatalabMode::Fast)
    ->outputFormat(DatalabOutput::Json)
    ->webhookUrl('https://testwebhook.com/test123') // optional; overrides account-level webhook for this request
    ->execute(); // alias of executeSync(), polls /marker/{request_id}

if ($response->isSuccess()) {
    // $response->markdown, $response->html, $response->json, $response->chunks
}

// If you only want the initial request_id response (no polling):
$queued = Datalab::marker()->executeAsync();
// $queued->requestId, $queued->requestCheckUrl, $queued->isValidationError()
```

### Schema API

[](#schema-api)

```
use ImmiTranslate\Datalab\Facades\Datalab;

$schemaResponse = Datalab::generateSchemas()
    ->checkpoint('asdf123')
    ->webhookUrl('https://test.com') // optional; overrides account-level webhook for this request
    ->generate(); // alias of generateSync(), polls request_check_url

if ($schemaResponse->isSuccess()) {
    // $schemaResponse->suggestions['simple_schema'], moderate_schema, complex_schema
}
```

### Form Filling API

[](#form-filling-api)

```
use ImmiTranslate\Datalab\Facades\Datalab;
use ImmiTranslate\Datalab\FormField;

$fillResponse = Datalab::formFilling()
    ->fields([
        new FormField(fieldKey: 'title', description: 'The title of the movie'),
        new FormField(fieldKey: 'director', description: 'The name of the director of the movie'),
    ])
    ->context('This is the form each Oscar nomination should fill out')
    ->confidenceThreshold(0.5)
    ->pageRange('1-15')
    ->file('/absolute/path/to/form.pdf') // optional local file upload
    ->execute(); // alias of executeSync(), polls request_check_url

if ($fillResponse->isSuccess()) {
    // Access full payload via $fillResponse->raw
}
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Ian Hawes](https://github.com/ianhawes)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance93

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~151 days

Total

2

Last Release

33d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/42096660?v=4)[ImmiTranslate](/maintainers/immitranslate)[@immitranslate](https://github.com/immitranslate)

---

Top Contributors

[![ianhawes](https://avatars.githubusercontent.com/u/423746?v=4)](https://github.com/ianhawes "ianhawes (33 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

laravelImmiTranslatedatalab-sdk-laravel

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/immitranslate-datalab-sdk-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/immitranslate-datalab-sdk-laravel/health.svg)](https://phpackages.com/packages/immitranslate-datalab-sdk-laravel)
```

###  Alternatives

[defstudio/telegraph

A laravel facade to interact with Telegram Bots

818355.4k3](/packages/defstudio-telegraph)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.2k12.6M140](/packages/dedoc-scramble)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5226.7k](/packages/simplestats-io-laravel-client)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3915.5k](/packages/rawilk-profile-filament-plugin)[masterix21/laravel-licensing

Laravel licensing package with polymorphic assignment to any model, activation keys, expirations/renewals, and seat control via LicenseUsage. Supports offline verification with public-key–signed tokens, a CLI to generate/rotate/revoke keys, and an extensible architecture via config and contracts.

1614.1k4](/packages/masterix21-laravel-licensing)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
