PHP code example of sharpapi / sharpapi-php-client

1. Go to this page and download the library: Download sharpapi/sharpapi-php-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sharpapi / sharpapi-php-client example snippets


use SharpAPI\SharpApiService\SharpApiService;

$sharpApi = new SharpApiService(SHARP_API_KEY);
$statusUrl = $sharpApi->summarizeText($text, 'English');
$result = $sharpApi->fetchResults($statusUrl);

use SharpAPI\ContentSummarize\SummarizeTextClient;

$client = new SummarizeTextClient(apiKey: SHARP_API_KEY);
$statusUrl = $client->summarizeText(
    content: $text,
    language: 'English'
);
$result = $client->fetchResults($statusUrl);

$sharpApi = new \SharpAPI\SharpApiService\SharpApiService(SHARP_API_KEY);

$statusUrl = $sharpApi->summarizeText($text, 'English');
$result = $sharpApi->fetchResults($statusUrl);

var_dump($result->getResultJson());
bash
composer