after-the-deadline-php
, (*1)
An unofficial, fully unit tested After The Deadline PHP client., (*2)
PHP 7.0+, (*3)
Usage
Keys
From http://www.afterthedeadline.com/api.slp, (*4)
We used to require users to register for an API key. We no longer do this but
applications are still required to submit an API key. The API key is used as
both a synchronous locking point (e.g., only one request/key is processed at a
time) and to enable server-side caching of results and session information.
This makes subsequent requests for the same key much faster., (*5)
To generate an API key, consider using a short string to identify your
application followed by a hash of something unique to the user or installation
of AtD, like the site URL., (*6)
Examples
Include, (*7)
composer require darrynten/after-the-deadline-php
Use, (*8)
use DarrynTen\AfterTheDeadlinePhp\AfterTheDeadline;
// Config options
$config = [
'key' => 'my-generated-key', // At the very least
'text' => $text, // You can pass text in
'format' => 'html' // You can also specify (plain is default)
];
// Make a translator
$checker = new AfterTheDeadline($config);
// Set text and type (html or plain)
$checker->setText($text);
$language->setFormat('plain');
// Enable / disable caching
$language->setCache(false);
// Get suggestions
$checker->checkDocument(); // does both spelling and grammar
$checker->checkGrammar(); // only does grammar
// Get stats on the text
$checker->stats();
// Get an explanation on the grammar of an incorrect type
// Not yet implemented
$checker->getInfo($term); // e.g. 'to be' should be re-written in active
See The AtD API Docs
for more on these options and their usage., (*9)
Outstanding
Acknowledgements
- Open a PR and put yourself here :)