PHP code example of matasarei / strike-plagiarism-php
1. Go to this page and download the library: Download matasarei/strike-plagiarism-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/ */
matasarei / strike-plagiarism-php example snippets
use Matasar\StrikePlagiarism\Client;
use Matasar\StrikePlagiarism\Document;
$client = new Client('YOUR_API_KEY');
$document = new Document(
'en', // language code (ISO 639-1)
'A test document', // title
'Yevhen Matasar', // author
'Yevhen Matasar', // coordinator
__DIR__ . '/test.pdf' // file uri
);
// Optional: Add specific metadata and configuration
$document->setCallbackUrl('https://your-site.com/webhook');
$document->setAiDetection(true);
$document->setGrammarCheck(true);
$document->setUserId('student-123');
$response = $client->addDocument($document);
// Fetch the report as a DTO (use `true` for a short report)
$report = $client->getReport($response['id'], short: false);
echo $report->getId(); // "12345-abcde"
echo $report->getStatus(); // "success"
echo $report->getSimilarity1(); // 10.5
echo $report->getSimilarity2(); // 0.0
echo $report->getTitle(); // "A test document"
echo $report->getAuthor(); // "Yevhen Matasar"
echo $report->getCoordinator(); // "Yevhen Matasar"
// To access any other properties from the raw response:
$status = $report->get('status');
// Or to get the entire raw JSON response as an array:
$rawData = $report->toArray();
// If you need the raw HTML report directly (as a string) instead of JSON:
$htmlString = $client->getReportHtml($response['id']);
// You can also fetch the report as a PDF:
$pdfString = $client->getReportPdf($response['id']);
use Matasar\StrikePlagiarism\CallbackWebhook;
$payload = file_get_contents('php://input');
$webhook = new CallbackWebhook($payload);
if ($webhook->isCompleted()) {
$reportId = $webhook->getDocumentId();
// fetch report...
}