Download the PHP package lea-reift/ocr-space without Composer
On this page you can find all versions of the php package lea-reift/ocr-space. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download lea-reift/ocr-space
More information about lea-reift/ocr-space
Files in lea-reift/ocr-space
Package ocr-space
Short Description OCR Space Api wrapper library for PHP
License MIT
Informations about the package ocr-space
OCR Space API Wrapper
A simple wrapper for OCR Space API
Installation
This wrapper requires:
- PHP ^8.2
- CURL extension enabled
You can easily install the wrapper with Composer:
Usage
The only required parameter for the Client is your apikey (this will be used in the requests). Then, you can chain the desired options in helper methods for the accepted request parameters.
API Reference
The Client class provides an interface to interact with the OCR.space API, enabling optical character recognition on images from different sources. Check OCR Space Documentation to dig deeper with the accepted values, but the library also counts with typed parameters methods, so use it won't be to difficult.
Constructor
Creates a new instance of the OCR Space client.
Parameters:
$apiKey- The API key for authenticating with the OCR.space service$baseUrl- The base URL of the API (optional, defaults to "https://api.ocr.space")$endpoint- The API endpoint (optional, defaults to "/parse/image")
Data Input Methods
fromUrl
Sets an image URL as input for OCR processing.
Parameters:
$url- Valid URL of the image to be processed
fromFile
Sets a local file as input for OCR processing.
Parameters:
$file- File path as string or CURLFile instance
fromBase64String
Sets a base64 string representing an image as input for OCR processing.
Parameters:
$base64String- Base64 string representing an image
Configuration Methods
language
Sets the language for OCR recognition.
Parameters:
$language- Language code as string or LanguageCodeEnum instance
isOverlayRequired
Determines if overlay is required on the processed image.
Parameters:
$isRequired- Boolean indicating if overlay is required
detectOrientation
Configures whether to automatically detect the image orientation.
Parameters:
$detectOrientation- Boolean indicating if orientation should be detected
fileType
Sets the file type of the input image.
Parameters:
$fileType- File type as string or FileTypeEnum instance
isCreateSearchablePdf
Determines if a searchable PDF should be created.
Parameters:
$isCreateSearchablePdf- Boolean indicating if a searchable PDF should be created
isSearchablePdfHideTextLayer
Determines if the text layer should be hidden in the searchable PDF.
Parameters:
$isSearchablePdfHideTextLayer- Boolean indicating if the text layer should be hidden
scale
Determines if the image should be scaled to improve OCR recognition.
Parameters:
$scale- Boolean indicating if the image should be scaled
isTable
Configures if the image contains data in table format.
Parameters:
$isTable- Boolean indicating if the image contains tables
engine
Sets the OCR engine to use.
Parameters:
$engine- Integer representing the OCR engine (defaults to 1)
options
Returns an array with all currently configured options.
Complete Usage Example
Contributing
Contributions are always welcome! Just open a Pull Request with your changes and I'll review it as soon as I can!
Credits
OCR.space is a service of a9t9 software GmbH. They are also in github
This package is an independent development that is in no way linked to a9t9 software. I want to acknowledge a9t9 for put this OCR service online.
License
This wrapper is made available under the MIT License (MIT). Please see License File for more information.
All versions of ocr-space with dependencies
ext-curl Version *