Download the PHP package docxtract/php-sdk without Composer

On this page you can find all versions of the php package docxtract/php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-sdk

DocXtract PHP SDK

Official PHP client for the DocXtract document extraction API.

Extract structured JSON from invoices, KYC documents, bank statements, HR paperwork, and 20+ other document types.

Requirements

PHP 8.1+ with the curl and json extensions. No other dependencies — no Guzzle, no PSR-18. The SDK uses plain cURL so it drops into shared hosting without version conflicts.

Install

Get an API key

The SDK is free and open source. The API it talks to needs an account.

  1. Go to docxtract.io and choose Start Free Trial
  2. Credentials arrive by email — no card required, no sales call
  3. Sign in at app.docxtract.io and copy your key from Settings

Keep the key in an environment variable, never in source control:

Two calls cost no credits, so you can confirm setup before spending anything:

Need higher limits, more credits, or a custom document type? [email protected].

Quickstart

The key separator matters. DocXtract keys are sk_ with an underscore. A hyphen after sk means the key belongs to a different API provider — the SDK rejects it up front rather than letting you debug a 401.

Large PDFs are the point of this SDK

The API does not process a PDF over 3 pages synchronously. It splits the document and returns 202 with a chunk manifest; you must then call process once per chunk and result to collect — handling retries, single-flight conflicts, a 2-hour job TTL, and partial results along the way.

extract() does all of that for you:

Same call, any page count. With progress reporting:

Why chunks are processed sequentially

The API's default rate limit is 10 requests per minute. Firing chunks in parallel does not finish sooner — it converts the work into 429s. If your key has tighter limits, pace the calls:

Manual control

The three raw calls are public if you want to drive the flow yourself — for example to distribute chunks across workers:

collectResult() is a pure read, re-fetchable within the TTL — so it doubles as a progress poll from another process.

collectResult($jobId, finalize: true) is irreversible. It permanently deletes all extracted data for the job. Only pass true once the result is stored on your side.

Discovering document types

models() costs no credits, so it is safe on every page load or to populate a dropdown. It returns only the types your key is permitted to use.

Error handling

Every API error code maps to a typed exception, so you can branch with catch instead of string-matching messages:

For finer branching, read the code off the base class:

Exception Codes
AuthenticationException invalid_api_key, expired_api_key
QuotaException usage_limit_exceeded, insufficient_credits
RateLimitException rate_limit_exceeded, too_many_open_jobs
RequestException invalid_request, invalid_file, invalid_file_type, file_too_large, invalid_options, unknown_model, page_limit_exceeded, method_not_allowed
ExtractionFailedException extraction_failed
JobException job_not_found, job_expired, chunk_in_progress, chunk_source_lost
ServerException server_error, persist_failed, server_busy
TransportException network failure — the API never answered

An unrecognised code falls back to DocXtractException rather than throwing, so a new server-side code will not break a deployed copy of this SDK.

Billing note. extraction_failed on the synchronous path still deducts 1 credit. Budget for it when reconciling usage. On the multi-page path the chunk stays available and is not charged until it succeeds. persist_failed charges nothing.

Pre-flight validation

File type and size are checked locally before any network call, so an unsupported file costs no round trip and no credits. Accepted: PDF, JPG, PNG, up to 10 MB and 150 pages.

Configuration

The base URL has no /api prefix. /api is the server's docroot, not part of the public path. If you see a TransportException about non-JSON output, this is usually why.

Pinning to v3

base_path exists for customers still on the older version:

v3 has no models and no multi-page support, and accepts PDF only. models() throws a clear error rather than a confusing 404. New integrations should stay on v3.1.

Tests

The suite is offline — no API key or network needed. tests/bootstrap.php falls back to a built-in PSR-4 autoloader if vendor/ is absent.

Links


Built by RPATech | docxtract.io


All versions of php-sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-curl Version *
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package docxtract/php-sdk contains the following files

Loading the files please wait ...