immitranslate / datalab-sdk-laravel
Laravel SDK for Datalab API
Package info
github.com/immitranslate/datalab-sdk-laravel
pkg:composer/immitranslate/datalab-sdk-laravel
Fund package maintenance!
v1.0.0
2026-02-14 19:59 UTC
Requires
- php: ^8.3
- illuminate/contracts: ^11.0||^12.0
- illuminate/http: ^11.0||^12.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.8
- orchestra/testbench: ^10.0.0||^9.0.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- spatie/laravel-ray: ^1.35
This package is not auto-updated.
Last update: 2026-03-29 18:53:07 UTC
README
To obtain an API key for Datalab, go to the API keys page once you've created an account.
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
Marker API
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
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
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
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.