bicycle/tesseract-bridge
PHP wrapper for Tesseract OCR with CLI and FFI backends. Configure the Tesseract binary, list available languages, and recognize text from images via a simple API. Tested on FreeBSD/Debian/Ubuntu with Tesseract 3/4.
['deu'] for German) aligns with Laravel’s localization features, enabling multilingual OCR workflows.--psm, --oem)?binary_path and default language.TesseractBridge::recognize($path, $languages) for concise usage.tesseract:test command to verify installation and language support.ShouldQueue jobs (e.g., RecognizeTextJob) for async processing.telescope to monitor failures (e.g., missing Tesseract binaries).apt-get install tesseract-ocr) or Docker.tesseract-ocr-all).extension=ffi in php.ini).composer require bicycle/tesseract-bridge
php artisan vendor:publish --provider="Bicycle\Tesseract\TesseractServiceProvider").AppServiceProvider.testGetVersion, getAvailableLanguages).composer.json until maintenance resumes.tesseract, libtesseract-dev)..env) for binary_path to support multi-environment setups.Command not found → Tesseract not installed.FFI not enabled → PHP extension missing.Unsupported language → Language pack not installed.stderr redirection).tesseract:install Artisan command to automate setup (e.g., using shell_exec).chunk() or queue batches to avoid memory issues.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Tesseract binary missing | OCR fails entirely | Fallback to a placeholder response or queue retry. |
| FFI extension disabled | FFI mode fails | Default to CLI mode or log a warning. |
| Unsupported image format | Recognition errors | Validate file types (e.g., mime_type) before processing. |
| High CPU/memory usage | Worker timeouts | Limit concurrency (e.g., max_jobs=5 in queue). |
| Language pack missing | Low accuracy for specific languages | Validate available languages before processing. |
Error opening data file).How can I help you explore Laravel packages today?