PHP code example of roave / signature
1. Go to this page and download the library: Download roave/signature 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/ */
roave / signature example snippets
// Creating a signer
$signer = new \Roave\Signature\FileContentSigner(
new \Roave\Signature\Encoder\Sha1SumEncoder()
);
// It'll give you a signature to the provided code content
$signature = $signer->sign(file_get_contents('/var/tmp/file.php'));
// Creating a signer checker
$signer = new \Roave\Signature\FileContentChecker(
new \Roave\Signature\Encoder\Sha1SumEncoder()
);
// It'll validate the signature on file content
$signer->check(file_get_contents('/var/tmp/signed-file.php'));