1. Go to this page and download the library: Download filecheck/filecheck-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
filecheck / filecheck-php example snippets
$fc = new \Filecheck\FilecheckClient(getenv('FILECHECK_SECRET_KEY'));
$result = $fc->jobs->verify($_POST['filecheck_job_id'], ['workflow_id' => 'wf_…']);
if (!$result->ok) {
http_response_code(422);
exit("Files not accepted ({$result->reason})");
}
// fulfil the order; $result->state is 'ready' or 'partial' (warnings accepted by policy)
// AppServiceProvider
$this->app->singleton(FilecheckClient::class,
fn () => new FilecheckClient(config('services.filecheck.secret')));
// CheckoutController
public function store(Request $request, FilecheckClient $fc)
{
$result = $fc->jobs->verify($request->input('filecheck_job_id'), ['workflow_id' => 'wf_…']);
abort_unless($result->ok, 422, "Files not accepted ({$result->reason})");
// …
}
// Two-leg upload (presign + S3) in one call → fileRef
$upload = $fc->uploads->create('/tmp/artwork.pdf', ['mime_type' => 'application/pdf']);
// Validate against PDF/X profiles — waits for the result by default
$res = $fc->jobs->validate(['sources' => [['fileRef' => $upload->fileRef, 'profile' => ['1b']]]]);
echo $res->job->outcome;
// Preflight + autofix — async by default; 'wait' => true to block until terminal
$fixed = $fc->jobs->fix([
'sources' => [['fileRef' => $upload->fileRef, 'profileId' => 'default']],
'wait' => true,
]);
$event = \Filecheck\Webhook\Webhooks::constructEvent(
file_get_contents('php://input'), // ALWAYS the raw body
$_SERVER['HTTP_X_FILECHECK_SIGNATURE'] ?? null,
null,
['verify' => false], // TEMPORARY until Filecheck ships webhook signing
);
if ($event->type === \Filecheck\Data\WebhookEvent::TYPE_JOB_COMPLETED) {
// $event->payload: id, status, outcome, taskIds, tasks[], finalized, …
}
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.