marcosmarcolin/fricc2_encrypter

Encrypt your php files using the fricc2 extension.

1.0.0 2022-12-29 17:28 UTC

This package is auto-updated.

Last update: 2024-04-29 05:06:11 UTC


README

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.

Encoder

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.

Installation

composer require marcosmarcolin/fricc2_encrypter

Compatibility

Tested only in Linux environment: Ubuntu and Debian.

PHP version >= 7.4.x is required.

How to use

To encode only 1 file:

<?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());
}

To code one directory to another recursively, use:

<?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

Code quality

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

Author

Marcos Marcolin marcolindev@gmail.com