Skip to content

PHP module for communicating with the Veryfi OCR API.

License

Notifications You must be signed in to change notification settings

veryfi/veryfi-php

Repository files navigation

https://veryfi.github.io/veryfi-php/

php - version License: MIT code coverage

Veryfi is a php module for communicating with the Veryfi OCR API

Installation

In your project root run

composer require veryfi/veryfi-php

Getting Started

Obtaining Client ID and user keys

If you don't have an account with Veryfi, please go ahead and register here: https://hub.veryfi.com/signup/api/

php API Client Library

The Veryfi library can be used to communicate with Veryfi API. All available functionality is described here DOC

Below is the sample script using Veryfi to OCR and extract data from a document:

How to use it?

// First, include the autoload file generated by Composer
require_once "path_to_your_vendor_autoload";

// Then use the Veryfi API
use veryfi\Client;

Process a document

$client_id = 'your_client_id';
$client_secret = 'your_client_secret';
$username = 'your_username';
$api_key = 'your_api_key';

$veryfi_client = new Client($client_id, $client_secret, $username, $api_key);
$categories = array('Advertising & Marketing', 'Automotive');
$file = 'path_to_your_image';
$return_associative = true;
$delete_after_processing = false;
$json_response = json_decode($veryfi_client->process_document($file, $categories, $delete_after_processing), $return_associative);

Update a document

$client_id = 'your_client_id';
$client_secret = 'your_client_secret';
$username = 'your_username';
$api_key = 'your_api_key';

$veryfi_client = new Client($client_id, $client_secret, $username, $api_key);
$document_id = 'your_document_id' //as int
$parameters = array('category' => 'Meals & Entertainment',
                    'total' => 11.23);
$return_associative = true;
$json_response = json_decode($veryfi_client->update_document($document_id, $parameters), $return_associative);

Need help?

Visit https://docs.veryfi.com/ to access integration guides and usage notes in the Veryfi API Documentation Portal

If you run into any issue or need help installing or using the library, please contact support@veryfi.com.

If you found a bug in this library or would like new features added, then open an issue or pull requests against this repo!

To learn more about Veryfi visit https://www.veryfi.com/

Tutorial

Below is an introduction to the php SDK.