@@ -47,18 +47,16 @@ Please refer to the official:
4747## Installation
4848
49491 . You can install the package via composer:
50-
51- ``` bash
52- composer require sharpapi/sharpapi-php-client
53- ```
54-
50+ ``` bash
51+ composer require sharpapi/sharpapi-php-client
52+ ```
55532. Register at [SharpApi.com](https://sharpapi.com/) and get the API key.
56-
5754** That' s it!**
5855
5956## Usage
6057
6158### Simple example
59+
6260```php
6361$sharpApi = new \SharpAPI\SharpApiService\SharpApiService(' 8bKzQl3cwckfVsnsN8T8p4BsACkziEQJ72U4pXpQ' );
6462
@@ -68,11 +66,12 @@ $resultSharpApiJob = $sharpApi->pollJobStatusAndFetchResults($statusUrl);
6866
6967var_dump($resultSharpApiJob ->getResultJson());
7068` ` `
69+
7170Typical use case require these steps:
7271
73721. Dispatch one of the available AI processing methods (this will return job processing status URL)
74732. Run ` pollJobStatusAndFetchResults($statusUrl )` method which operates in polling mode, sending underneath
75- requests every 10 seconds for 180 seconds (these values can be customized,
74+ requests every 10 seconds for 180 seconds (these values can be customized,
7675 check ` SharpApiService` source code).
77763. ` SharpApiJob` object will be returned.
78774. For a job finished with ` success` return status you can obtain the results with one
@@ -95,6 +94,7 @@ As long as the job is still being processed by our engine it will keep
9594returning `pending` status.
9695
9796### Guzzle Exceptions
97+
9898Underlying HTTP requests are powered with Guzzle,
9999so it' s a good idea to check for
100100typical [Guzzle Exceptions](https://docs.guzzlephp.org/en/stable/quickstart.html#exceptions):
@@ -105,7 +105,7 @@ use GuzzleHttp\Exception\ClientException;
105105// Step 1: dispatch the job to the API with one of the methods, for example:
106106try {
107107 $statusUrl = \S harpApiService::summarizeText($text , ' German' );
108- // $statusUrl example value: 'http ://sharpapi.com/api/v1/job/status/75acb6dc-a975-4969-9ef1-c62cebc511cb'
108+ // $statusUrl example value: ' https ://sharpapi.com/api/v1/job/status/75acb6dc-a975-4969-9ef1-c62cebc511cb'
109109} catch (ClientException $e ) {
110110 // $e->getResponse ()
111111}
@@ -121,7 +121,6 @@ $jobResultArray = $jobResult->getResultArray();
121121$jobResultObject = $jobResult->getResultObject ();
122122` ` `
123123
124-
125124### Framework Controller usage example
126125
127126` ` ` php
@@ -173,7 +172,10 @@ Each method always returns `SharpApiJob` object, where its
173172` getResultJson / getResultArray / getResultObject`
174173methods will return different data structure.
175174Please refer to the detailed examples provided
176- at [ SharpAPI.com] ( https://sharpapi.com/ )
175+ at [SharpAPI.com](https://sharpapi.com/).
176+
177+ For methods that have language parameter you can also
178+ use ` SharpApiLanguages` Enum values to make your code more readable.
177179
178180### HR
179181
@@ -241,7 +243,7 @@ Parses the customer's product review and provides its sentiment (POSITIVE/NEGATI
241243with a score between 0-100%. Great for sentiment report processing for any online store.
242244
243245```php
244- $statusUrl = \SharpApiService::productReviewSentiment('review contents', 'English' );
246+ $statusUrl = \SharpApiService::productReviewSentiment(' review contents' );
245247```
246248
247249#### Product Categories
@@ -347,7 +349,7 @@ Parses the Travel/Hospitality product review and provides its sentiment
347349Great for sentiment report processing for any online store.
348350
349351` ` ` php
350- $statusUrl = \SharpApiService::travelReviewSentiment($text, 'English' );
352+ $statusUrl = \S harpApiService::travelReviewSentiment($text );
351353` ` `
352354
353355# ### Tours & Activities Product Categories
0 commit comments