1. Go to this page and download the library: Download ssitu/spirit 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/ */
ssitu / spirit example snippets
use SSITU\Spirit\Spirit;
use SSITU\Sod\Sod;
af4dd03ebe11e35167157a8a697d8a2cb545a907a38289f8a7ba19432a342';
$sodConfig["flavour"] = "Sugar"; # prefer "Sodium" if installed
// Sod init:
$Sod = new Sod($sodConfig);
// Spirit init:
$Spirit = new Spirit($Sod);
//You can also pass Sod like so:
# $Spirit->setSod($Sod);
// Print config (could also be a decoded json file, cf. samples/):
$printConfig = [
'keyLength' => 32,
'width' => 286,
'height' => 186,
'margin' => 9,
'minfillerLen' => 32,
'imgExtension' => 'png',
'printTexts' => true,
'headerText' => 'PASS',
'footerText' => 'www.some-domain.com/login',
'mainText' => 'Bob',
'addtTexts' => ['guest of Ida'],
'fontFilePath' => '../samples/sourcessproxtrlight.ttf',
'textColorCodes' => [160,160,160],
'fontSize' => 11,
'angle' => 0,
'lineSpacer' => 2,
'adtlines' => 4,
'bgImgPath' => '../samples/baseImg.png',
'useBgImg' => false,
'bgColorCodes' => [255,255,255],
'drawFrame' => true,
'lineColorCodes' => [160, 160,160,],
];
// Some data to inject (must be a string):
$dataToInject = 'such Secret much Hidden wow';
// Printing image:
// returns an array with 'image' (b64 format) and 'key'
$printRslt = $Spirit->printImg($dataToInject, $printConfig);
// Reading image (either a filepath, or a b64 image can be passed)
// returns decoded data
$Spirit->readImg($printRslt['image'], $printRslt['key']);
// If providing a key: it must consist of b64 characters only;
// and length must match with the one specified in config
$givenKey = 'Hf/mRnoh3mJDl8w+7DuhelTdHIWuj4V4';
$printRslt = $Spirit->printImg($dataToInject, $printConfig, $givenKey);
// Reading previously stored image
$safelyStoredSpiritKey = 'nCLz32iG2hyu67lWCKBSFHeZw2qh1cFx';
$Spirit->readImg('../samples/spirit-image.png', $safelyStoredSpiritKey);
// If something went wrong:
$Spirit->getLogs();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.