bicycle/tesseract-bridge

Integration of tesseract bridge via FFI and CLI

Maintainers

👁 vkhramtsov

Package info

github.com/vkhramtsov/tesseract-bridge

pkg:composer/bicycle/tesseract-bridge

Statistics

Installs: 274

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

0.250 2021-01-28 16:13 UTC

Requires

  • php: >7.4.0

Requires (Dev)

Suggests

  • ext-ffi: So you can use tesseract via ffi integration

Provides

None

Conflicts

None

Replaces

None

MIT 93b360cf4ea7b93b25120fbcfadc668c3bf58303

clilibraryTesseractOCRintegrationffi

This package is auto-updated.

Last update: 2026-06-08 18:26:17 UTC


README

A wrapper to work with Tesseract OCR inside PHP via CLI and/or FFI interfaces.

👁 Minimum PHP Version
👁 Build Status
👁 Codacy Badge
👁 codecov
👁 Scrutinizer Code Quality
👁 Latest stable version on packagist
👁 Total downloads
👁 Monthly downloads
👁 License

‼️ Tested only on FreeBSD, Debian and Ubuntu platforms with Tesseract OCR version 3 and 4 (see build logs).

Installation

Via Composer:

$ composer require bicycle/tesseract-bridge

Usage

Basic usage

👁 example

  • CLI ```php use Bicycle\Tesseract\Bridge as TesseractBridge;

    $configuration = TesseractBridge\Configuration(['binary_path' => 'tesseract']);
    $bridge = new TesseractBridge\CLI($configuration);
    echo $bridge->testGetVersion();
    print_r($bridge->getAvailableLanguages());
    echo $bridge->recognizeFromFile('eurotext.png'); // Set proper path here
    ```
    
  • FFI ```php use Bicycle\Tesseract\Bridge as TesseractBridge;

    $configuration = TesseractBridge\Configuration(['binary_path' => 'tesseract']);
    $bridge = new TesseractBridge\FFI($configuration);
    echo $bridge->testGetVersion();
    print_r($bridge->getAvailableLanguages());
    echo $bridge->recognizeFromFile('eurotext.png'); // Set proper path here
    ```
    

With languages

  • CLI ```php use Bicycle\Tesseract\Bridge as TesseractBridge;

    $configuration = TesseractBridge\Configuration(['binary_path' => 'tesseract']);
    $bridge = new TesseractBridge\CLI($configuration);
    echo $bridge->testGetVersion();
    print_r($bridge->getAvailableLanguages());
    echo $bridge->recognizeFromFile('eurotext.png', ['deu']); // Set proper path here
    ```
    
  • FFI ```php use Bicycle\Tesseract\Bridge as TesseractBridge;

    $configuration = TesseractBridge\Configuration(['binary_path' => 'tesseract']);
    $bridge = new TesseractBridge\FFI($configuration);
    echo $bridge->testGetVersion();
    print_r($bridge->getAvailableLanguages());
    echo $bridge->recognizeFromFile('eurotext.png', ['deu']); // Set proper path here
    ```
    

How to contribute

You can contribute to this project by:

  • Opening an Issue if you found a bug or wish to propose a new feature;
  • Opening PR if you want to improve/create/fix something

Additional

Please check our FAQ

License

tesseract-bridge is released under the MIT License.