10
10
[ ![ 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 )
11
11
[ ![ Total Downloads] ( https://img.shields.io/packagist/dt/sharpapi/sharpapi-laravel-client.svg?style=flat-square )] ( https://packagist.org/packages/sharpapi/sharpapi-laravel-client )
12
12
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
14
15
platform.
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:
16
18
[ E-commerce] ( https://sharpapi.com/#ecommerce ) ,
17
19
[ HR Tech] ( https://sharpapi.com/#hr ) ,
18
20
[ Travel] ( https://sharpapi.com/#tth ) ,
@@ -25,6 +27,9 @@ or [SEO](https://sharpapi.com/#seo).
25
27
- PHP >= 8.1
26
28
- Laravel >= 9.0
27
29
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
+
28
33
## Features
29
34
30
35
Please refer to the official:
@@ -46,7 +51,7 @@ Please refer to the official:
46
51
47
52
## Installation
48
53
49
- 1 . You can install the package via composer:
54
+ 1 . You can install the package via ` composer ` :
50
55
51
56
``` bash
52
57
composer require sharpapi/sharpapi-laravel-client
@@ -66,10 +71,6 @@ SHARP_API_KEY=8bKzQl3cwckfVsnsN8T8p4BsACkziEQJ72U4pXpQ
66
71
67
72
You can inject ` SharpApiService ` class or use the facade ` \SharpApiService ` singleton.
68
73
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
-
73
74
We recommend you to use Laravel queuing system to optimize dispatched jobs
74
75
and the process of checking the results, especially if you process bigger batches of data.
75
76
@@ -143,37 +144,11 @@ class SharpTest extends Controller
143
144
}
144
145
```
145
146
147
+ #### Guzzle Exceptions
146
148
The underlying HTTP requests are facilitated by
147
149
[ Laravel HTTP Client/Guzzle] ( https://laravel.com/docs/10.x/http-client ) ,
148
150
making it advisable to familiarize yourself with common
149
151
[ 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
-
177
152
``` php
178
153
use GuzzleHttp\Exception\ClientException;
179
154
@@ -240,15 +215,16 @@ methods will return different data structure.
240
215
Please refer to the detailed examples provided
241
216
at [ SharpAPI.com] ( https://sharpapi.com/ )
242
217
218
+ For methods that have ` language ` parameter you can also use
219
+ ` SharpApiLanguages ` Enum values to make your code more readable.
220
+
243
221
### HR
244
222
245
223
#### Parse Resume/CV File
246
224
247
225
Parses a resume (CV) file from multiple formats (PDF/DOC/DOCX/TXT/RTF) and returns an extensive object of data points.
248
226
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) .
252
228
253
229
``` php
254
230
$statusUrl = \SharpApiService::parseResume('/test/resume.pdf', 'English');
@@ -308,7 +284,7 @@ Parses the customer's product review and provides its sentiment (POSITIVE/NEGATI
308
284
with a score between 0-100%. Great for sentiment report processing for any online store.
309
285
310
286
``` php
311
- $statusUrl = \SharpApiService::productReviewSentiment('review contents', 'English' );
287
+ $statusUrl = \SharpApiService::productReviewSentiment('review contents');
312
288
```
313
289
314
290
#### Product Categories
@@ -414,7 +390,7 @@ Parses the Travel/Hospitality product review and provides its sentiment
414
390
Great for sentiment report processing for any online store.
415
391
416
392
``` php
417
- $statusUrl = \SharpApiService::travelReviewSentiment($text, 'English' );
393
+ $statusUrl = \SharpApiService::travelReviewSentiment($text);
418
394
```
419
395
420
396
#### Tours & Activities Product Categories
@@ -455,7 +431,7 @@ $statusUrl = \SharpApiService::hospitalityProductCategories(
455
431
456
432
### Do you think our API is missing some obvious functionality?
457
433
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 )
459
435
460
436
## Changelog
461
437
0 commit comments