A simple PHP wrapper for the PLText API.
You can install the package via Composer.
composer require pltext/sdkFirst, ensure you have your PLText API key. You can provide it directly or load it from a .env file using a library like vlucas/phpdotenv.
require 'vendor/autoload.php';
use Dotenv\Dotenv;
use Pltext\Pltext;
// Example of loading from a .env file
$dotenv = Dotenv::createImmutable(__DIR__);
$dotenv->load();
$apiKey = $_ENV['PLTEXT_API_KEY'];
// Or, provide the key directly:
$apiKey = "your_pltext_api_key_here";
$client = new Pltext($apiKey);
$content = "This is the text content you want to check for plagiarism.";
try {
$result = $client->checkContent($content);
print_r($result);
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}For local development, you can create a .env file in the project root. Your application code (like in example.php) is responsible for loading these variables.
PLTEXT_API_KEY=your_pltext_api_key_here
PLTEXT_API_URL=http://localhost:5033/api/v1/check