Official libraries

### PHP

The filecheck/filecheck-php server SDK — verify jobs before fulfilling, upload and process files, and handle webhooks.

filecheck/filecheck-php

mirrors the

Node.js SDK

method-for-method for PHP 8.1\+. HTTP goes through any PSR-18 client (auto-discovered, or injected — Guzzle, Symfony HttpClient), with a bundled cURL fallback so it works with zero extra dependencies. Responses are typed, readonly value objects.

composer

require

filecheck/filecheck-php

The secret key (

sk\_…

) is server-side only. Load it from configuration or the environment — never commit it or expose it to the browser.

### Navigate to header: Verify a job before fulfilling Verify a job before fulfilling

verify()

confirms the job is

terminal

,

proceedable

(the Element’s

canProceed

equivalent, with the Workflow’s on-fail policy applied), and — with

workflow\_id

— that it ran the expected Workflow. The returned

VerifyResult

carries

ok

,

state

,

reason

, and the full

job

.

### Navigate to header: Upload and process files Upload and process files

// Two-leg upload (presign \+ storage POST) in one call → fileRef

$upload

=

$fc

-&gt;

uploads

-&gt;

create

(

'/tmp/artwork.pdf'

, \[

'mime\_type'

=&gt;

'application/pdf'

\]);

// Preflight \+ auto-fix; 'wait' =&gt; true blocks until the job is terminal

$res

=

$fc

-&gt;

jobs

-&gt;

fix

(\[

'sources'

=&gt;

\[\[

'fileRef'

=&gt;

$upload

-&gt;

fileRef

,

'profileId'

=&gt;

'default'

\]\],

'wait'

=&gt;

true

,

\]);

echo

$res

-&gt;

job

-&gt;

outcome

;

Every submit method takes

'wait'

/

'wait\_timeout'

(seconds) instead of the API’s raw

sync

/

async

flags, with defaults matching each endpoint (

validate

and

optimize

wait by default; the rest are async). If the server’s ~27-second window elapses, the SDK keeps polling for you.

A blocking wait ties up the PHP worker — mind FPM request time limits. For long-running jobs, prefer the per-job

webhook

parameter and process the callback instead.

### Navigate to header: Surface Surface

| Method | Endpoint |
| --- | --- |
| $fc-&gt;jobs-&gt;create / preflight / previews / fix / validate / optimize | POST /jobs and the sugar wrappers |
| $fc-&gt;jobs-&gt;retrieve($id) / retrieveRuns($id) | GET /jobs/\{id\} (± ?expand=runs ) |
| $fc-&gt;jobs-&gt;list() / iterate() / delete($id) / waitUntilTerminal($id) | GET /jobs , DELETE /jobs/\{id\} , polling helper |
| $fc-&gt;jobs-&gt;verify($id, $opts) | The fulfillment gate |
| $fc-&gt;uploads-&gt;create($pathOrBytesOrStream, $opts) | POST /uploads \+ the storage leg |
| $fc-&gt;orders-&gt;create($orderId, $params) | POST /orders/\{id\} |
| $fc-&gt;workflows / connectors / rules / profiles / optimizePresets -&gt;all() / -&gt;get($id) | Read-only library |
| Webhooks::constructEvent($rawBody, $sig, $secret, $opts) | Webhook parsing |

Client options:

new FilecheckClient('sk\_…', \['base\_url', 'timeout', 'max\_retries', 'http\_client'\])

. Passing a publishable

pk\_…

key throws immediately, and keys are never echoed in full.

### Navigate to header: Webhooks Webhooks

$event

=

\\Filecheck\\Webhook\\

Webhooks

::

constructEvent

(

file\_get\_contents

(

'php://input'

),

// always the raw body

$\_SERVER

\[

'HTTP\_X\_FILECHECK\_SIGNATURE'

\]

??

null

,

null

,

\[

'verify'

=&gt;

false

\],

);

if

(

$event

-&gt;

type

===

\\Filecheck\\Data\\

WebhookEvent

::

TYPE\_JOB\_COMPLETED

) \{

// $event-&gt;payload — id, status, outcome, tasks, …

\}

In Laravel, exempt the route from CSRF and use

$request-&gt;getContent()

for the raw body. Webhook

signature verification

is not yet live;

\['verify' =&gt; false\]

is the explicit, temporary opt-in for unsigned payloads, and the helper is designed so verification becomes the default without a breaking change once the signing scheme ships.

### Navigate to header: Errors and retries Errors and retries

Typed exceptions in

Filecheck\\Exception

—

AuthenticationException

(401/403),

InvalidRequestException

(400),

NotFoundException

(404),

RateLimitException

(429),

ApiException

(5xx),

ConnectionException

— carry

status

and the parsed body. Catch by class, not message text.

Idempotent GETs are retried automatically (exponential backoff with jitter,

Retry-After

honored).

POSTs are never auto-retried

: the API has no idempotency keys, and a duplicated

POST /jobs

creates and bills a second job.

Suggest edits

Raise issue

[Node.js SDK](https://filecheck.io/docs/integrations/node)

[signature verification](https://filecheck.io/docs/server/webhooks)

[Suggest edits](https://github.com/sterlyai/mintlify-docs/edit/main/integrations/php.mdx)

[Raise issue](https://github.com/sterlyai/mintlify-docs/issues/new?title=Issue%20on%20docs&body=Path:%20/integrations/php)

[Navigate to header: Verify a job before fulfilling](https://filecheck.io/docs/integrations/php#verify-a-job-before-fulfilling)

[Navigate to header: Upload and process files](https://filecheck.io/docs/integrations/php#upload-and-process-files)

[Navigate to header: Surface](https://filecheck.io/docs/integrations/php#surface)

[Navigate to header: Webhooks](https://filecheck.io/docs/integrations/php#webhooks)

[Navigate to header: Errors and retries](https://filecheck.io/docs/integrations/php#errors-and-retries)

## Plain PHP

$fc

=

new

\\Filecheck\\

FilecheckClient

(

getenv

(

'FILECHECK\_SECRET\_KEY'

));

$result

=

$fc

-&gt;

jobs

-&gt;

verify

(

$\_POST

\[

'fc\_job\_id'

\], \[

'workflow\_id'

=&gt;

'wf\_…'

\]);

if

(

\!

$result

-&gt;

ok

) \{

http\_response\_code

(

422

);

exit

(

"Files not accepted (\{

$result

-&gt;

reason

\})"

);

\}

// fulfill — $result-&gt;state is 'ready' or 'partial' (warnings accepted by policy)

// AppServiceProvider

$this

-&gt;

app

-&gt;

singleton

(

FilecheckClient

::

class

,

fn

() =&gt;

new

FilecheckClient

(

config

(

'services.filecheck.secret'

)));

// CheckoutController

public

function

store

(

Request

$request

,

FilecheckClient

$fc

)

\{

$result

=

$fc

-&gt;

jobs

-&gt;

verify

(

$request

-&gt;

input

(

'fc\_job\_id'

), \[

'workflow\_id'

=&gt;

'wf\_…'

\]);

abort\_unless

(

$result

-&gt;

ok

,

422

,

"Files not accepted (\{

$result

-&gt;

reason

\})"

);

// …

\}