This package aims to facilitate the encryption of your PHP scripts using the FRICC2 extension.
It is just a resource to facilitate the use of the Encoder which is executed via Shell.
For the tool to work, you need to have the encoder in /usr/bin/fricc2
installed on your OS.
By default, it will use the name fricc2
, but if you installed it with another name, you can inform it in the constructor of the Encrypter
class.
composer require marcosmarcolin/fricc2_encrypter
Tested only in Linux environment: Ubuntu and Debian.
PHP version >= 7.4.x is required.
<?php
use MarcosMarcolin\Fricc2Encrypter\Encrypter;
include 'vendor/autoload.php';
$from = __DIR__ . '/src/file.php';
$to = __DIR__ . '/src/new_file.php';
try {
$Encrypter = new Encrypter($from, $to);
$Encrypter->simpleEncrypt(); // true or false
} catch (Exception $e) {
// Any error that occurs will throw an exception.
var_dump($e->getMessage());
}
<?php
try {
$Encrypter = new Encrypter($from, $to);
$Encrypter->recursiveEncrypt(); // true or false
} catch (Exception $e) {
// Any error that occurs will throw an exception.
var_dump($e->getMessage());
}
To capture the files that failed or succeeded use:
<?php
// Only for recursive encoder
$faileds = $Encrypter->getFaileds()); // array
$success = $Encrypter->getSuccess()); // array
To check for errors with PHPCS:
composer phpcs
To automatically correct errors with PHPCS:
composer phpcbf
To check for errors with PHPInsights:
composer phpinsights
To automatically correct errors with PHPInsights:
composer phpinsights-fix
Marcos Marcolin [email protected]