Quickly and easily connect to Mindee's API services using PHP.
Here's the TL;DR of getting started.
First, get an API Key
If you do not have them, you'll need the following packages on your system:
- php-curl
- php-json (not necessary for versions >= 8.0.0)
- php-fileinfo
Then, install this library:
composer require mindee/mindee
Finally, PHP away!
<?php
use Mindee\Client;
use Mindee\Product\Invoice\InvoiceV4;
// Init a new client
$mindeeClient = new Client("my-api-key");
// Load a file from disk
$inputSource = $mindeeClient->sourceFromPath("/path/to/the/file.ext");
// Parse the file
$apiResponse = $mindeeClient->parse(InvoiceV4::class, $inputSource);
// Print a brief summary of the parsed data
echo strval($apiResponse->document);
Note: Files can also be loaded from:
A PHP File
compatible file:
$inputDoc = $mindeeClient->sourceFromFile($myFile);
A URL (HTTPS
only):
$inputDoc = $mindeeClient->sourceFromUrl("https://files.readme.io/a74eaa5-c8e283b-sample_invoice.jpeg");
A base64-encoded string, making sure to specify the extension of the file name:
$inputDoc = $mindeeClient->sourceFromB64($myInputString, "my-file-name.ext");
Raw bytes, making sure to specify the extension of the file name:
$inputDoc = $mindeeClient->sourceFromBytes($myRawBytesSequence, "my-file-name.ext");
use Mindee\Client;
use Mindee\Product\Us\BankCheck\BankCheckV1;
// Init a new client
$mindeeClient = new Client("my-api-key");
// Load a file from disk
$inputSource = $mindeeClient->sourceFromPath("/path/to/the/file.ext");
// Parse the file
$apiResponse = $mindeeClient->parse(BankCheckV1::class, $inputSource);
// Print a brief summary of the parsed data
echo strval($apiResponse->document);
use Mindee\Client;
use Mindee\Product\Us\BankCheck\BankCheckV1;
// Init a new client
$mindeeClient = new Client("my-api-key");
// Load a file from disk
$inputSource = $mindeeClient->sourceFromPath("/path/to/the/file.ext");
// Parse the file
$apiResponse = $mindeeClient->parse(BankCheckV1::class, $inputSource);
// Print a brief summary of the parsed data
echo strval($apiResponse->document);
Complete details on the working of the library are available in the following guides:
- Getting started
- PHP Command Line Interface (CLI)
- PHP Custom APIs (API Builder)
- PHP Generated APIs
- PHP Invoice OCR
- PHP Receipt OCR
- PHP Financial Document OCR
- PHP Passport OCR
- PHP Resume OCR
- PHP Proof of Address OCR
- PHP International Id OCR
- PHP EU License Plate OCR
- PHP EU Driver License OCR
- PHP FR Bank Account Detail OCR
- PHP FR Carte Grise OCR
- PHP FR Carte Vitale OCR
- PHP FR ID Card OCR
- PHP US Bank Check OCR
- PHP US W9 OCR
- PHP US Driver License OCR
- PHP Barcode Reader API
- PHP Cropper API
- PHP Invoice Splitter API
- PHP Multi Receipts Detector API
You can view the source code on GitHub.
You can also take a look at the Reference Documentation.
Copyright © Mindee
Available as open source under the terms of the MIT License.