PHP code example of vielhuber / slopdetector

1. Go to this page and download the library: Download vielhuber/slopdetector 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/ */

    

vielhuber / slopdetector example snippets



declare(strict_types=1);

pdetector;

$detector = slopdetector::create();
$models = $detector->listModels();

$result = $detector->analyzeText(
    text: 'Text to analyze',
    model: $models[0]
);

print_r($result);

$result = $detector->analyzeFile(filePath: '/path/to/document.pdf');

$job = $detector->submitBulk(
    items: [
        ['id' => 'article-1', 'text' => 'First text'],
        ['id' => 'article-2', 'text' => 'Second text']
    ],
    model: $models[0]
);

$status = $detector->getBulkStatus(bulkId: $job['bulk_id']);
$results = $detector->getBulkResults(bulkId: $job['bulk_id'], offset: 0, limit: 100);
bash
vendor/bin/mcp-server.php