Download the PHP package api2convert/sdk without Composer

On this page you can find all versions of the php package api2convert/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 sdk

API2Convert PHP SDK

CI Packagist Version PHP License

The official PHP client for the API2Convert file-conversion API. Convert, compress and transform images, documents, audio, video, ebooks, archives and CAD — and run operations like OCR, merge, thumbnail and website capture — in one line of code.

That single call creates a job, uploads your file, starts it, waits for it to finish and gives you back a result you can save. No polling loops, no manual upload handling.

Requirements

Install

Get an API key from the API2Convert dashboard / documentation.

Quick start

convert($input, $to, $options = [])$input is a local path, a public URL, or an open stream/resource; $to is the target format; $options are the conversion options for that target. Less-common controls are named arguments: category, timeout, outputIndex, filename, downloadPassword. The returned ConversionResult lets you:

Password-protect the result

Pass downloadPassword and the output is locked behind it. The SDK remembers the password and sends it automatically when you download — you don't pass it again:

The download URL still needs the password from anywhere else (a browser, cURL, another process), via the X-Api2convert-Download-Password header. When you already hold an OutputFile — e.g. from the Jobs API — hand the password to download():

Asynchronous conversions & webhooks

For long-running jobs, start the conversion and get notified via a webhook instead of waiting:

In your webhook handler, verify and parse the callback:

Signed webhooks are being rolled out. Until they are enabled for your account no signature is sent — call Api2Convert::webhooks()->parse($payload) (or pass an empty secret) to deserialize the callback without verifying.

Cloud storage

Read an input straight from your own S3, Azure, FTP or Google Cloud storage, and/or deliver the converted output into a bucket — no re-uploading, no re-downloading.

Read the input from S3. A CloudInput is a started job, just like a remote URL — build it with the per-provider factory (flat, lowercase keys, exactly as the API expects) and save the result locally:

azure(container, file, accountname, accountkey), ftp(host, file, username, password) and googleCloud(projectid, bucket, file, keyfile) work the same way.

Deliver the output to S3. Attach one or more OutputTargets via outputTargets. When a target is set the conversion delivers straight to your storage and there's no local download:

Credentials ride in the request body but are redacted in exception messages and when a CloudInput/OutputTarget is printed or logged (credentials renders as [REDACTED]) — they are never surfaced on read.

Error handling

Every failure is a typed exception extending Api2Convert\Exception\Api2ConvertException:

Exception When
AuthenticationException 401 / 403 — bad or missing key
PaymentRequiredException 402 — no remaining quota
ValidationException 400 — invalid request (e.g. unknown target)
NotFoundException 404 — resource doesn't exist
RateLimitException 429 — exposes ->retryAfter
ServerException 5xx
ConversionFailedException the job reached failed; exposes ->job and ->errors()
TimeoutException the job didn't finish within the poll timeout
SignatureVerificationException a webhook payload failed verification

Transient failures (429, 5xx, network errors) are retried automatically with exponential backoff.

Power user: the full job API

convert() is sugar over the Jobs API. Drop down to it for compound jobs, merges, presets, custom polling or job chaining:

Available resources: jobs(), conversions() (the catalog + option discovery), presets(), stats(), contracts().

Discover the valid options for any target:

Configuration

Bring your own PSR-18 client (e.g. Symfony HttpClient) by passing it as the third argument.

Security — never publish your API key

Development

The live conformance suite runs against the real API when API2CONVERT_API_KEY is set (it auto-skips otherwise):

It runs automatically against the real API on every release tag (see .github/workflows/live-conformance.yml), so a published version is always verified end to end. Each test mirrors one of the runnable examples below, plus two negative tests (an unknown target is a typed validation error; a bad key is a typed auth error that never leaks the key).

Examples

Every example in examples/ is a complete, self-contained program that reads your key from API2CONVERT_API_KEY. Run any of them with, e.g.:

Example What it shows
quickstart.php Convert a remote JPG to PNG, look the job up, download it
convert-files.php Browse the conversions catalog, then convert
uploading-files.php One-call upload + convert of a local file
job-lifecycle.php Drive create → add input → start → wait → outputs by hand
add-watermark.php Stamp a PNG watermark onto a PDF (two inputs)
create-thumbnails.php Render the first PDF page as a PNG thumbnail
compress-files.php Compress a JPG at a high compression level
create-archives.php Bundle two remote files into a ZIP
create-hashes.php Compute the SHA-256 of a remote ZIP
extract-assets.php Extract embedded assets from a DOCX
file-analysis.php Extract a JPG's metadata as JSON
compare-files.php Diff two images (SSIM) with a red overlay
capture-website.php Screenshot a website and deliver a PNG
audio-operations.php Transcode a WAV to stereo 192 kbps AAC
image-operations.php Resize a JPG, cropping to keep the aspect ratio
webhooks.php Start an async conversion with a callback, and verify the receipt
presets.php List saved conversion presets
statistics.php Read API usage for a month
rate-limits.php Inspect the account's contracts (quota/limits)
authentication.php Verify the key works by listing jobs

This SDK is hand-written and kept in sync with the API by an AI agent — see AGENTS.md and docs/SDK_CONTRACT.md. Notable changes are recorded in docs/CHANGELOG.md.

License

MIT — see LICENSE.


All versions of sdk with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-json Version *
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1 || ^2.0
guzzlehttp/guzzle Version ^7.15.2 || ^8.0.1
guzzlehttp/psr7 Version ^2.13 || ^3.0
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 api2convert/sdk contains the following files

Loading the files please wait ...