1. Go to this page and download the library: Download yolorouter/llmasking-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/ */
yolorouter / llmasking-php example snippets
$engine = Engine::new();
$session = $engine->newSession();
$result = $session->anonymize("I'm John, my phone is 13800138000");
// $result->text → "I'm John, my phone is [PHONE_1]"
// ... send $result->text to the LLM ...
$restored = $session->restore("Sure, I'll contact [PHONE_1]");
// $restored->text → "Sure, I'll contact 13800138000"
$client = new MaskingClient(
$innerClient, // any PSR-18 ClientInterface
$streamFactory, // any PSR-17 StreamFactoryInterface
$engine,
);
// Every outgoing request is anonymized; every response (including SSE streams) is restored.