PHP code example of kerogs / kerogs-php

1. Go to this page and download the library: Download kerogs/kerogs-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/ */

    

kerogs / kerogs-php example snippets




use Kerogs\KerogsPhp\[name];



use Kerogs\KerogsPhp\Key;
$key = new Key(1);

echo $key->keyGeneration(16);

    private static $keyTypes = [
        1 => "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-( )'!@#$%^&*",
        2 => "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-( )'!",
        3 => "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-( )",
        4 => "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-",
        5 => "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
        6 => "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
        7 => "abcdefghijklmnopqrstuvwxyz",
        8 => "0123456789",
        9 => "abcdefghijklmnopqrstuvwxyz0123456789"
    ];



use Kerogs\KerogsPhp\Logs;

const LogsKey = 'abcd-efgh-ijkl-mnop';
$logs = new Logs(LogsKey, true);

$logs->addLog(null, "User successfully logged in", 200, "INFO", false, true);

addLog(
    string $pathLogs = null,
    string $message = "-",
    int $statusCode = 200,
    string $logType = "INFO",
    bool $logIp = false,
    bool $logRequestData = false
):

encryptDecryptFile(string $filePath, bool $encrypt): void



use Kerogs\KerogsPhp\Sendmail;

const from = "[email protected]";
const to = "[email protected]";

$sendmail = new Sendmail(from);

if($sendmail->sendMail(to, "Subject test", "hello world")))
    echo "Email sent successfully";
else
    echo "Email not sent";



use Kerogs\KerogsPhp\Github;

$github = new Github();

$lastRelease = $github->compareVersions("1.3.17", $github->getLatestRelease("KSLaboratories", "kerogsPHP", false)['name']);

if($lastRelease['same']) {
    echo "KerogsPHP is up to date !";
} else{
    if($lastRelease['comparison'] === 'above') {
        echo "KerogsPHP is outdated ! (above)";
    } else {
        echo "KerogsPHP is outdated ! (below)";
    }
}



use Kerogs\KerogsPhp\Algorithm;

$algo = new Algorithm();

$searchBanana = $algo->searchEngine(['banana', 'apple', 'orange', 'pineapple'], 'banana');

print_r($searchBanana);