PHPackages                             jfuentestgn/ocr-space - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. jfuentestgn/ocr-space

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jfuentestgn/ocr-space
=====================

Laravel OCR.space API Client

943.1k4[1 issues](https://github.com/jfuentestgn/ocr-space/issues)[1 PRs](https://github.com/jfuentestgn/ocr-space/pulls)PHP

Since Jan 19Pushed 7y ago1 watchersCompare

[ Source](https://github.com/jfuentestgn/ocr-space)[ Packagist](https://packagist.org/packages/jfuentestgn/ocr-space)[ RSS](/packages/jfuentestgn-ocr-space/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel OCR.space API
=====================

[](#laravel-ocrspace-api)

![Work in progress](https://camo.githubusercontent.com/e154875864cfc69a2bf93f2142734db6fe1513c350b3d2796d3d4c13c8534592/68747470733a2f2f696d672e736869656c64732e696f2f776166666c652f6c6162656c2f6576616e636f68656e2f736d6172742d6d6972726f722f696e25323070726f67726573732e7376673f7374796c653d706c6173746963)![License: MIT](https://camo.githubusercontent.com/778515fbd66003ef968d1fb5356021105a237d9452a1ff6753d8c07e8b263496/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f646f637472696e652f6f726d2e7376673f7374796c653d706c6173746963)

Laravel (or just plain PHP) class for calling  [free API](https://ocr.space/ocrapi)

This package provides an independent implementation of an OCR.space API client for Laravel (or PHP) applications

OCR.API is a free/paid API for the OCR.space online service that converts images of text documents in text strings using OCR technologies

Requirements
------------

[](#requirements)

- PHP &gt;= 5.6.4
- A valid key from [OCR API](https://ocr.space/ocrapi) (registration needed)

Installation
------------

[](#installation)

To get OCR.space API just use the require command of composer or edit manually your composer.json, adding the require block (then you should run composer update):

```
$ composer require jfuentestgn/ocr-space
```

```
{
    "require": {
        "jfuentestgn/ocr-space": "dev-master"
    }
}
```

After install the package, if you want to use it in a Laravel application, you should register the service provider. Add the OcrServiceProvider class to the list of providers in config/app.php:

```
  'providers' => [
    ....
    JFuentesTgn\OcrSpace\OcrServiceProvider::class,
    ...
    ]
```

If you want to use the Facade version of the service, you could add an alias in `config/app.php`:

```
  'aliases' => [
    ....
    'OCR' => JFuentesTgn\OcrSpace\OcrFacade::class,
    ...
    ]
```

Configuration
-------------

[](#configuration)

This package requires an API key to work. First of all, register in the [OCR API site](https://ocr.space/ocrapi) to get a valid KEY

Publish vendor assets to get a local copy of the config file:

```
$ php artisan vendor:publish --provider=JFuentesTgn\\OcrSpace\\OcrServiceProvider
```

This will create a `config/ocrspace.php` file in your app. Edit this file and update the API key configuration property

Usage
-----

[](#usage)

In Laravel, you can use the OcrAPI class service as any other injected service. As an exemple:

```
use JFuentesTgn\OcrSpace\OcrAPI;

class TestController extends Controller
{

  public function processImage(Request $request, OcrAPI $ocr)
  {
    // You can use the $ocr instance to call OCR.space web service
    $response = $ocr->parseImageFile($imageFile);
  }
}
```

If you prefer to use the facade interface, you can do just this:

```
  $response = OCR::parseImageFile($imageFile);
```

Laravel is not a requirement for this package. If you need to use it outside a Laravel app, you can just create an instance of the API as with any other class:

```
  $ocr = new OcrAPI($apiKey);
  $response = $ocr->parseImageFile($imageFile);
```

In this case you MUST pass your API key as a parameter to the constructor

The response (`JFuentesTgn\OcrSpace\OcrResponse`) object returned by the OcrAPI methods maps [JSON response](https://ocr.space/ocrapi#Response) from OCR.space online service in an object oriented way.

This is an example of how to read the service response:

```
$image = 'snap_005.jpg';
$response = $ocr->parseImageFile($image);
if ($response->length() == 1) {
  $text = $response->items(0)->text();
}
```

Credits
-------

[](#credits)

This package is maintained by [Juan Fuentes](https://github.com/jfuentestgn)

OCR.space is a service of [a9t9 software GmbH](https://a9t9.com/about). They are also in [github](https://github.com/A9T9)

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
-------

[](#license)

Laravel OCR.space API is licensed under [The MIT License (MIT)](LICENSE).

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8889182?v=4)[Juan Fuentes](/maintainers/jfuentestgn)[@jfuentestgn](https://github.com/jfuentestgn)

---

Top Contributors

[![jfuentestgn](https://avatars.githubusercontent.com/u/8889182?v=4)](https://github.com/jfuentestgn "jfuentestgn (3 commits)")

### Embed Badge

![Health badge](/badges/jfuentestgn-ocr-space/health.svg)

```
[![Health](https://phpackages.com/badges/jfuentestgn-ocr-space/health.svg)](https://phpackages.com/packages/jfuentestgn-ocr-space)
```

###  Alternatives

[event-engine/discolight

Lightweight PSR-11 DI Container inspired by bitExpert/disco

1028.9k1](/packages/event-engine-discolight)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
