copyleaks / php-plagiarism-checker
Copyleaks detects online plagiarism and checks content distribution. Use Copyleaks to find out if textual content is original and where it has been used before. This package shows how to integrate with the Copyleaks cloud to search for copyright infringement.
Installs: 63 929
Dependents: 0
Suggesters: 0
Security: 0
Stars: 48
Watchers: 8
Forks: 26
Open Issues: 2
Requires
- php: >=7.4.0
- dev-master
- v5.1.1
- v5.1.0
- v5.0.0
- v4.4.0
- v4.3.1
- v4.3.0
- v4.2.0
- v4.1.2
- v4.1.1
- v4.1.0
- 4.0.1
- v4.0.0
- v3.2.1
- v3.2.0
- v3.1.0
- 3.0.2
- v3.0.1
- 3.0.0
- v1.4
- v1.3
- v1.2
- v1.1
- dev-fix-backslash-at-index
- dev-disconnect-ai-source-code-detection
- dev-AI-code-detection-sunset-v2
- dev-AI-code-detection-sunset
- dev-add-text-moderation
- dev-add-missing-models
- dev-features/1207019394509570/add-missing-property-allow-same-domain
- dev-features/1207019394509570/add-writing-feedback-and-ai-detector
- dev-features/1203221642267913/update-properties
- dev-features/multi-tenant
This package is auto-updated.
Last update: 2025-09-18 09:52:40 UTC
README
The official Copyleaks PHP library, supporting PHP versions >=7.4.0.
π Getting Started
Before you start, ensure you have the following:
- An active Copyleaks account. If you donβt have one, sign up for free.
- You can find your API key on the API Dashboard.
Once you have your account and API key:
Install the SDK:
Install using Packagist
composer require copyleaks/php-plagiarism-checker
π Documentation
To learn more about how to use Copyleaks API please check out our Documentation.
π‘ Usage Examples
Here are some common usage examples for the Copyleaks SDK. You can also see a comprehensive code example in the demo.php
file on our GitHub repository: demo.php.
Get Authentication Token
This example demonstrates how to log in to the Copyleaks API and obtain an authentication token.
<?php require_once(__DIR__ . '/vendor/autoload.php'); use Copyleaks\Copyleaks; use Copyleaks\CopyleaksFileSubmissionModel; use Copyleaks\SubmissionProperties; use Copyleaks\SubmissionWebhooks; // --- Your Credentials --- $EMAIL_ADDRESS = 'YOUR_EMAIL_ADDRESS'; $KEY = 'YOUR_API_KEY'; $WEBHOOK_URL = 'https://your-server.com/webhook/{STATUS}'; // -------------------- // Log in to the Copyleaks API echo "Authenticating...\n"; $copyleaks = new Copyleaks(); $loginToken = $copyleaks->login($EMAIL_ADDRESS, $KEY); echo "β Logged in successfully!\n";
For a detailed understanding of the authentication process, refer to the Copyleaks Login Endpoint Documentation.
Submit Text for Plagiarism Scan
This example shows how to prepare and submit raw text content for a plagiarism scan.
<?php require_once(__DIR__ . '/vendor/autoload.php'); use Copyleaks\Copyleaks; use Copyleaks\CopyleaksFileSubmissionModel; use Copyleaks\SubmissionProperties; use Copyleaks\SubmissionWebhooks; // --- Your Credentials --- $EMAIL_ADDRESS = 'YOUR_EMAIL_ADDRESS'; $KEY = 'YOUR_API_KEY'; $WEBHOOK_URL = 'https://your-server.com/webhook/{STATUS}'; // -------------------- // Prepare your content for scanning echo "Submitting text for scanning...\n"; $textToScan = "Hello world, this is a test."; $base64Content = base64_encode($textToScan); $scanId = time(); // Configure the scan $webhooks = new SubmissionWebhooks($WEBHOOK_URL); $properties = new SubmissionProperties($webhooks); $properties->setSandbox(true); // Turn on sandbox mode for testing $submission = new CopyleaksFileSubmissionModel($base64Content, 'test.txt', $properties); // Submit the scan to Copyleaks $copyleaks->submitFile($loginToken, $scanId, $submission); echo "π Scan submitted successfully! Scan ID: " . $scanId . "\n"; echo "You will be notified via your webhook when the scan is complete.\n";
For a full guide please refer to our step by step Guide
For a detailed understanding of the plagiarism detection process, refer to the Copyleaks Submit Endpoint Documentation
AI-Generated Text Detection
Use the AI detection client to determine if content was generated by artificial intelligence.
<?php require_once(__DIR__ . '/vendor/autoload.php'); use Copyleaks\Copyleaks; use Copyleaks\CopyleaksNaturalLanguageSubmissionModel; // --- Your Credentials --- $EMAIL_ADDRESS = 'YOUR_EMAIL_ADDRESS'; $KEY = 'YOUR_API_KEY'; $WEBHOOK_URL = 'https://your-server.com/webhook/{STATUS}'; // -------------------- $sampleText = "Lions are social animals, living in groups called prides, typically consisting of several females, their offspring, and a few males. Female lions are the primary hunters, working together to catch prey. Lions are known for their strength, teamwork, and complex social structures."; $submission = new CopyleaksNaturalLanguageSubmissionModel( $sampleText, ); $submission->sandbox = true; $response = $this->copyleaks->aiDetectionClient->submitNaturalLanguage($authToken, time(), $submission); $this->logInfo('AI Detection - submitNaturalLanguage', $response);
Writing Assistant
Get intelligent suggestions for improving grammar, spelling, style, and overall writing quality.
<?php require_once(__DIR__ . '/vendor/autoload.php'); use Copyleaks\Copyleaks; use Copyleaks\CopyleaksWritingAssistantSubmissionModel; use Copyleaks\ScoreWeights; // --- Your Credentials --- $EMAIL_ADDRESS = 'YOUR_EMAIL_ADDRESS'; $KEY = 'YOUR_API_KEY'; $WEBHOOK_URL = 'https://your-server.com/webhook/{STATUS}'; // -------------------- $sampleText = "Lions are the only cat that live in groups, called pride. A prides typically consists of a few adult males, several feales, and their offspring. This social structure is essential for hunting and raising young cubs. Female lions, or lionesses are the primary hunters of the prid. They work together in cordinated groups to take down prey usually targeting large herbiores like zbras, wildebeest and buffalo. Their teamwork and strategy during hunts highlight the intelligence and coperation that are key to their survival."; $scoreWeights = new ScoreWeights( 0.1, 0.2, 0.3, 0.4 ); $submission = new CopyleaksWritingAssistantSubmissionModel( $sampleText, ); $submission->sandbox = true; $submission->score = $scoreWeights; $response = $this->copyleaks->writingAssistantClient->submitText($authToken, time(), $submission); $this->logInfo('Writing Assistant - submitText', $response);
For a full guide please refer to our step by step Guide
For a detailed understanding of the Writing assistant process, refer to the Copyleaks writing feedback Endpoint Documentation
Text Moderation
Scan and moderate text content for unsafe, inappropriate, or policy-violating material across various categories.
<?php require_once(__DIR__ . '/vendor/autoload.php'); use Copyleaks\Copyleaks; use Copyleaks\CopyleaksTextModerationRequestModel; use Copyleaks\CopyleaksTextModerationConstants; use Copyleaks\CopyleaksTextModerationLanguages; use Copyleaks\CopyleaksTextModerationResponseModel; // --- Your Credentials --- $EMAIL_ADDRESS = 'YOUR_EMAIL_ADDRESS'; $KEY = 'YOUR_API_KEY'; $WEBHOOK_URL = 'https://your-server.com/webhook/{STATUS}'; // -------------------- $labelsArray=[ new CopyleaksTextModerationLabel(CopyleaksTextModerationConstants::ADULT_V1), new CopyleaksTextModerationLabel(CopyleaksTextModerationConstants::TOXIC_V1), new CopyleaksTextModerationLabel(CopyleaksTextModerationConstants::VIOLENT_V1), new CopyleaksTextModerationLabel(CopyleaksTextModerationConstants::PROFANITY_V1), new CopyleaksTextModerationLabel(CopyleaksTextModerationConstants::SELF_HARM_V1), new CopyleaksTextModerationLabel(CopyleaksTextModerationConstants::HARASSMENT_V1), new CopyleaksTextModerationLabel(CopyleaksTextModerationConstants::HATE_SPEECH_V1), new CopyleaksTextModerationLabel(CopyleaksTextModerationConstants::DRUGS_V1), new CopyleaksTextModerationLabel(CopyleaksTextModerationConstants::FIREARMS_V1), new CopyleaksTextModerationLabel(CopyleaksTextModerationConstants::CYBERSECURITY_V1) ]; // labels $textModerationRequest = new CopyleaksTextModerationRequestModel( "This is some text to scan.", // text true, // sandbox mode CopyleaksTextModerationLanguages::ENGLISH, // language $labelsArray ); $response = $this->copyleaks->textModerationClient->submitText($authToken, time(), $model); $textModerationResponse= CopyleaksTextModerationResponseModel::fromArray(json_decode(json_encode($response), true)); $this->logInfo('Text Moderation - submitText', $textModerationResponse);
For a full guide please refer to our step by step Guide
For a detailed understanding of the Text moderation process, refer to the Copyleaks text moderation Endpoint Documentation
Further Resources
- Copyleaks API Dashboard: Manage your API keys, monitor usage, and view analytics from your personalized dashboard. Access Dashboard
- Copyleaks SDK Documentation: Explore comprehensive guides, API references, and code examples for seamless integration. Read Documentation
Support
- If you need assistance, please contact Copyleaks Support via our support portal: Contact Copyleaks Support.
- To arrange a product demonstration, book a demo here: Booking Link.