artstorm/monkeylearn-api

This package is abandoned and no longer maintained. No replacement package was suggested.

MonkeyLearn API v2 client

0.5 2016-04-02 03:49 UTC

This package is not auto-updated.

Last update: 2020-01-24 15:51:36 UTC


README

Build Status Scrutinizer Code Quality Scrutinizer Coverage Status StyleCI MIT licensed

An easy to use client to consume MonkeyLearn API v2 with PHP.

Install

Via Composer

$ composer require artstorm/monkeylearn-api

Requirements

  • PHP >= 5.4.0.
  • PHP Curl.

Basic usage of MonkeyLearn API PHP Client

$token = 'monkeylearn-api-token';
$client = new Artstorm\MonkeyLearn\Client($token);

$textToClassify = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
$module = 'module_id';
$response = $client->classification->classify($textToClassify, $module);

print_r($response->result());

Debug and Sandbox

MonkeyLearn has a Sandbox mode that can be used for custom modules. There is also an option to include debug data in the responses. These options can be enabled with the methods Client::sandbox() and Client::debug(). The methods are chainable.

$response = $client->sandbox()->classification->classify($text, $module);
$response = $client->debug()->classification->classify($text, $module);
$response = $client->sandbox()->debug()->classification->classify($text, $module);

Query Limits

To find out current query limits with MonkeyLearn API, that information is available in the response object.

$response = $client->classification->classify($text, $module);

$limits = $response->limits();

License

The library is open-sourced software licensed under the MIT license.