sturt/salary

Parse salary slip in images, get the salary amount

Installs: 7

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Language:HTML

v1.0.0 2018-12-16 07:05 UTC

This package is auto-updated.

Last update: 2024-04-08 02:17:32 UTC


README

Extract Salary real number from image format salary Slip

Installation

Scraper requires PHP 7.1 or 7.2. This particular version supports Laravel 5.5 or 5.6 only.

To get the latest version, simply require the project using Composer:

Via Composer

$ composer require sturt/salary

Once installed, if you are not using automatic package discovery, then you need to register the sturt\salary\SalaryServiceProvider::class, service provider in your config/app.php.

Configuration

Scraper supports optional configuration.

To get started, you'll need to publish all vendor assets:

$ php artisan vendor:publish

This will create a config/sa.php file in your app that you can modify to set your configuration. Also, make sure you check for changes to the original config file in this package between releases.

Configuration

Open sa.php from Config

return [
    // add more patterns if needed
    'patterns'      =>  [
        'net pay',
        'et pay',
        'net payable',
        'gross pay',
        'total pay',
        'net pay',
    ],

    // Image file stored path
    
    'FILE_PATH'     =>   base_path() ."/public/uploads/",
    
    //Change Route ULR
    
    'ROUTE_NAME'    =>  'upload_salary_slip',

    // Change Language - More language coming soon
    'OCR_LANG'      =>  'eng',

]; 

Usage

get request to /upload_salary_slip/file.jpg located in public/uploads/

Output

Success

{"status":200,"salary":"35,430.00"}

File not found

{"status":204,"file_not_found":"\/public\/file Not found"}

Note for Windows users

There are many ways to install Tesseract OCR on your system, but if you just want something quick to get up and running, I recommend installing the Capture2Text package with Chocolatey.

choco install capture2text --version 3.9

⚠️ Recent versions of Capture2Text stopped shipping the tesseract binary.


Note for macOS users

With MacPorts you can install support for individual languages, like so:

$ sudo port install tesseract-<langcode>

But that is not possible with Homebrew. It comes only with English support by default, so if you intend to use it for other language, the quickest solution is to install them all:

$ brew install tesseract --with-all-languages

License

tesseract-ocr-for-php is released under the MIT License.