aws / aws-sdk-php-laravel

A Laravel 5+ (and 4) service provider for the AWS SDK for PHP
http://aws.amazon.com/sdkforphp/
Apache License 2.0
1.64k stars 242 forks source link

Example of Textextractor #199

Closed syedabbas-72 closed 1 year ago

syedabbas-72 commented 3 years ago

Hi, I need an example of text extractor for Laravel using aliases. I tried my level best to do it, but I was unable to get the result.

Please Help Me.

yenfryherrerafeliz commented 1 year ago

Hi @syedabbas-72, thanks for opening this issue. Here is an example of textract to analyze a document:

Choosing the document from a bucket:

$client = App::make('aws')->createClient('Textract', [
    'region' => 'REGION',
]);

$response = $client->analyzeDocument([
    'Document' => [
        'S3Object' => [
            'Bucket' => 'BUCKET',
            'Key' => 'DOCUMENT'
        ],
    ],
    'FeatureTypes' => ['TABLES', 'FORMS', 'QUERIES'],
]);

return response()->json(['result' => 'ok']);

Or from bytes:

$client = App::make('aws')->createClient('Textract', [
    'region' => 'REGION',
]);

$response = $client->analyzeDocument([
    'Document' => [
        'Bytes' => FILE_IN_BYTES
    ],
    'FeatureTypes' => ['TABLES', 'FORMS', 'QUERIES'],
]);

return response()->json(['result' => 'ok']);

Here is the API reference for Textract so you can find more information about the different requests you can do over this service.

Thanks!

github-actions[bot] commented 1 year ago

This issue has not recieved a response in 1 week. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.

syedabbas-72 commented 1 year ago

I will check it Out, Thanks for the Reply @yenfryherrerafeliz

syedabbas-72 commented 1 year ago

I will check it Out, Thanks for the Reply @yenfryherrerafeliz

@abbasmashaddy72 Please Have a Look into it