1. Go to this page and download the library: Download kminet/php-obfuscator 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/ */
kminet / php-obfuscator example snippets
private string $apiKey; // @phpobf-ignore-line
public function getToken(): string { ... } // @phpobf-ignore-line external API contract
// @phpobf-ignore-next-line
private string $apiKey;
// @phpobf-ignore-next-line VERSION = '1.0.0';
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
use PhpObfuscator\Obfuscator\Obfuscator;
$logger = (new Logger('phpobf'))->pushHandler(new StreamHandler('php://stdout'));
$obf = new Obfuscator(outputDir: '/path/to/output');
$obf->setLogger($logger);
$obf->setSource('/path/to/your/project')
->setLevel(1)
->setTestMode(false)
->setObfuscatePaths(true)
->obfuscate();
// Input
namespace App\Service;
use App\Model\User;
// Creates a user
class UserService {
public function create(User $user): void {}
}
// Output
namespace aB3kQz\xR9mLp;
class fT7wNq {
public function create(\aB3kQz\qP2vYm $user): void {}
}
// Input
namespace App\Service;
function helperFn(): void {}
class UserService {
public function create(User $user): void {
$this->validate($user);
}
private function validate(User $user): void {}
}
$service = new UserService();
$service->create(new User());
helperFn();
UserService::staticMethod();
// Output (methods and functions renamed on top of Level 0 structural obfuscation)
namespace aB3kQz\xR9mLp;
function kQ8mZp(): void {}
class fT7wNq {
public function nX4vRt(\aB3kQz\qP2vYm $user): void {
$this->pL6hWs($user);
}
private function pL6hWs(\aB3kQz\qP2vYm $user): void {}
}
$service = new fT7wNq();
$service->nX4vRt(new \aB3kQz\qP2vYm());
kQ8mZp();
fT7wNq::mR2jYk();
// Input
class School {
private string $name;
public function __construct(string $name) {
$this->name = $name;
}
}
$hogwarts = new School("Hogwarts");
$teacher = new Teacher("Albus", "Dumbledore");
$hogwarts->addTeacher($teacher);
// Output (variables and properties renamed on top of Level 1 obfuscation)
class fT7wNq {
private string $xR9mLp;
public function __construct(string $xR9mLp) {
$this->xR9mLp = $xR9mLp;
}
}
$nXvRtQp = new fT7wNq("Hogwarts");
$kQmZpYs = new aB3kQz("Albus", "Dumbledore");
$nXvRtQp->pL6hWs($kQmZpYs);
bash
composer global c/
bash
composer hpobf --level 1 src/
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.