1. Go to this page and download the library: Download monkeylearn/monkeylearn-php 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/ */
monkeylearn / monkeylearn-php example snippets
// Use the API key from your account
$ml = new MonkeyLearn\Client('<YOUR API KEY HERE>');
// Create a new classifier
$res = $ml->classifiers->create('Test Classifier');
// Get the id of the new module
$model_id = $res->result['id'];
// Get the classifier detail
$res = $ml->classifiers->detail($model_id);
// Create two new tags on the classifier
$res = $ml->classifiers->tags->create($model_id, 'Negative');
$negative_id = $res->result['id'];
$res = $ml->classifiers->tags->create($model_id, 'Positive');
$positive_id = $res->result['id'];
// Now let's upload some data
$data = array(
array('text' => 'The movie was terrible, I hated it.', 'tags' => [$negative_id]),
array('text' => 'I love this movie, I want to watch it again!', 'tags' => [$positive_id])
);
$res = $ml->classifiers->upload_data($model_id, $data);
// Classify some texts
$res = $ml->classifiers->classify($model_id, ['I love the movie', 'I hate the movie']);
var_dump($res->result);
$ml = new MonkeyLearn\Client('<YOUR API KEY HERE>');
$res = $ml->extractors->extract('<Extractor ID>', ['Some text to extract.']);
bash
$ php composer.phar install
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.