1010[ ![ Latest Version on Packagist] ( https://img.shields.io/packagist/v/sharpapi/sharpapi-laravel-client.svg?style=flat-square )] ( https://packagist.org/packages/sharpapi/sharpapi-laravel-client )
1111[ ![ Total Downloads] ( https://img.shields.io/packagist/dt/sharpapi/sharpapi-laravel-client.svg?style=flat-square )] ( https://packagist.org/packages/sharpapi/sharpapi-laravel-client )
1212
13- Assisting coders with the most repetitive content analysis and content generation processing needs of any app or
13+ Assisting coders with the most repetitive content analysis
14+ and content generation processing needs of any app or
1415platform.
15- SharpAPI is an easy-to-use REST API endpoints to help automate your app AI content processing whether it's:
16+ SharpAPI is an easy-to-use REST API endpoints to help automate your
17+ app AI content processing whether it's:
1618[ E-commerce] ( https://sharpapi.com/#ecommerce ) ,
1719[ HR Tech] ( https://sharpapi.com/#hr ) ,
1820[ Travel] ( https://sharpapi.com/#tth ) ,
@@ -25,6 +27,9 @@ or [SEO](https://sharpapi.com/#seo).
2527- PHP >= 8.1
2628- Laravel >= 9.0
2729
30+ If you don't use Laravel then you can find
31+ [ Generic SharpAPI PHP Client here » ; ] ( https://github.com/sharpapi/sharpapi-php-client )
32+
2833## Features
2934
3035Please refer to the official:
@@ -46,7 +51,7 @@ Please refer to the official:
4651
4752## Installation
4853
49- 1 . You can install the package via composer:
54+ 1 . You can install the package via ` composer ` :
5055
5156``` bash
5257composer require sharpapi/sharpapi-laravel-client
@@ -66,10 +71,6 @@ SHARP_API_KEY=8bKzQl3cwckfVsnsN8T8p4BsACkziEQJ72U4pXpQ
6671
6772You can inject ` SharpApiService ` class or use the facade ` \SharpApiService ` singleton.
6873
69- Underlying HTTP requests are powered via [ Laravel HTTP Client/Guzzle] ( https://laravel.com/docs/10.x/http-client ) ,
70- so it's a good idea to check for
71- typical [ Guzzle Exceptions] ( https://docs.guzzlephp.org/en/stable/quickstart.html#exceptions ) .
72-
7374We recommend you to use Laravel queuing system to optimize dispatched jobs
7475and the process of checking the results, especially if you process bigger batches of data.
7576
@@ -143,37 +144,11 @@ class SharpTest extends Controller
143144}
144145```
145146
147+ #### Guzzle Exceptions
146148The underlying HTTP requests are facilitated by
147149[ Laravel HTTP Client/Guzzle] ( https://laravel.com/docs/10.x/http-client ) ,
148150making it advisable to familiarize yourself with common
149151[ Guzzle Exceptions] ( https://docs.guzzlephp.org/en/stable/quickstart.html#exceptions ) .
150-
151- For optimal performance, we suggest leveraging Laravel's queuing system
152- when dispatching jobs, particularly when handling larger datasets.
153- This enhances the efficiency of both job dispatching and result retrieval processes.
154-
155- The typical use case involves the following steps:
156-
157- 1 . Dispatch one of the available AI processing methods, which will provide a job processing status URL.
158- 2 . Execute the ` pollJobStatusAndFetchResults($statusUrl) ` method, operating in polling mode and making requests every 10
159- seconds for a duration of 180 seconds (modifiable,
160- see [ optional custom configuration] ( #optional-custom-configuration ) ).
161- 3 . Receive a ` SharpApiJob ` object.
162- 4 . For a job marked as ` success ` , retrieve the results using one of the available methods, such
163- as ` $jobResultJson = $jobResult->getResultJson() ` .
164-
165- ** Generally, each dispatched job concludes within a timeframe ranging from a few seconds to a minute.**
166-
167- Upon completion, a job with a ` success ` status will have its results ready for further processing. Different API
168- methods/endpoints yield varying return formats; refer to
169- the [ List of API methods/endpoints] ( #list-of-api-methodsendpoints ) for details.
170-
171- Our API ensures consistent formatting in every response. However, it's worth noting that AI engines utilized by SharpAPI
172- may occasionally exhibit aberrant behavior, leading to timeouts or inaccurate data. In such instances, the job status
173- will be marked as ` failed ` . Simply rerun the identical job request in these cases.
174-
175- While the job is actively processed by our engine, it will consistently report a ` pending ` status.
176-
177152``` php
178153use GuzzleHttp\Exception\ClientException;
179154
@@ -240,15 +215,16 @@ methods will return different data structure.
240215Please refer to the detailed examples provided
241216at [ SharpAPI.com] ( https://sharpapi.com/ )
242217
218+ For methods that have ` language ` parameter you can also use
219+ ` SharpApiLanguages ` Enum values to make your code more readable.
220+
243221### HR
244222
245223#### Parse Resume/CV File
246224
247225Parses a resume (CV) file from multiple formats (PDF/DOC/DOCX/TXT/RTF) and returns an extensive object of data points.
248226
249- The file has to be uploaded as ` form-data ` parameter called ` file ` .
250-
251- An optional language parameter can also be provided (` English ` value is set as the default one) .
227+ An optional output language parameter can also be provided (` English ` value is set as the default one) .
252228
253229``` php
254230$statusUrl = \SharpApiService::parseResume('/test/resume.pdf', 'English');
@@ -308,7 +284,7 @@ Parses the customer's product review and provides its sentiment (POSITIVE/NEGATI
308284with a score between 0-100%. Great for sentiment report processing for any online store.
309285
310286``` php
311- $statusUrl = \SharpApiService::productReviewSentiment('review contents', 'English' );
287+ $statusUrl = \SharpApiService::productReviewSentiment('review contents');
312288```
313289
314290#### Product Categories
@@ -414,7 +390,7 @@ Parses the Travel/Hospitality product review and provides its sentiment
414390Great for sentiment report processing for any online store.
415391
416392``` php
417- $statusUrl = \SharpApiService::travelReviewSentiment($text, 'English' );
393+ $statusUrl = \SharpApiService::travelReviewSentiment($text);
418394```
419395
420396#### Tours & Activities Product Categories
@@ -455,7 +431,7 @@ $statusUrl = \SharpApiService::hospitalityProductCategories(
455431
456432### Do you think our API is missing some obvious functionality?
457433
458- [ Please let us know»] ( https://github.com/sharpapi/laravel-client/issues )
434+ [ Please let us know»] ( https://github.com/sharpapi/sharpapi- laravel-client/issues )
459435
460436## Changelog
461437
0 commit comments