/prowritingaid.php

Official PHP SDK. Grammar checking API for PHP. Also includes: style improvements, terminology checking, and plagiarism checking API.

Primary LanguagePHP

ProWritingAid.API

Official PHP prowritingaid.com API.

  • API version: v2

For more information, please visit https://prowritingaid.com/en/App/API#php

Requirements

PHP 5.5 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "minimum-stability": "dev",
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/prowriting/prowritingaid.php.git"
    }
  ],
  "require": {
    "prowriting/prowritingaid.php": "*"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/SwaggerClient-php/autoload.php');

Getting Started

Please follow the installation procedure and then run the following:

<?php

require_once(__DIR__ . '/vendor/autoload.php');
use ProWritingAidSDK\Configuration;
use ProWritingAidSDK\Api\TextApi;
use ProWritingAidSDK\Model\TextAnalysisRequest;

$config = new Configuration();
$config->setHost('https://api.prowritingaid.com');
$config->setApiKey('licenseCode', 'YOUR API KEY');
$api_instance = new TextApi(null, $config);

$request = new TextAnalysisRequest();
$request->setText('I place my cane firmly on the ground and, slowly, with its aid, \'
                    \'I lower myself from the hammock. Now the rains have gone my joints \'
                    \'don\'t hurt so badly. Today won\'t be too bad, I think. I\'m prone to \'
                    \'be over optimistic. Could this be my last day. At this time the jungle \'
                    \'is strangely subdued. She poke around in the ashes. Every day the \'
                    \'weariness is even worst than beofre. I don\'t know yett. \n\'
                    \'Whne? What a weka statement. Jaroslav Drabny is a Czech football goalkeeper. \'
                    \'Bhuvnehwar Kumar is a Czech football goalkeeper. I just saw Siyabonga Siyo. \'
                    \'I just saw Siyabonga Seyo. I read this article on RaelSport.');
$request->setStyle('General');
$request->setLanguage('en');
$request->setReports(['grammar']);

try {
    $result = $api_instance->post($request);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling the API: ', $e->getMessage(), PHP_EOL;
}

?>

Documentation for API Endpoints

All URIs are relative to https://api.prowritingaid.com

Class Method HTTP request Description
ContextualThesaurusApi get GET /api/async/contextualthesaurus/result/{taskId} Tries to get the result of a request using the task id of the request
ContextualThesaurusApi post POST /api/async/contextualthesaurus Analyses text and returns contextual thesaurus entries
HtmlApi get GET /api/async/html/result/{taskId} Tries to get the result of a request using the task id of the request
HtmlApi post POST /api/async/html Analyses HTML and adds suggestion tags to it
SummaryApi get GET /api/async/summary/result/{taskId} Tries to get the result of a request using the task id of the request
SummaryApi post POST /api/async/summary Gets the summary analysis of a document
TextApi get GET /api/async/text/result/{taskId} Tries to get the result of a request using the task id of the request
TextApi post POST /api/async/text Analyses text and returns tags for it
ThesaurusApi post POST /api/thesaurus Returns the thesaurus entries for a specific word
WordCloudApi get GET /api/async/wordcloud/result/{taskId} Tries to get the result of a request using the task id of the request
WordCloudApi post POST /api/async/wordcloud Analyses text and returns a word cloud (as an image)

Documentation For Models

Documentation For Authorization

licenseCode

  • Type: API key
  • API key parameter name: licenseCode
  • Location: HTTP header