PHP code example of bicycle / tesseract-bridge

1. Go to this page and download the library: Download bicycle/tesseract-bridge 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/ */

    

bicycle / tesseract-bridge example snippets


        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
        

        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
        

        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
        

        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