https://github.com/roave/signature
:black_nib: Generate and verify basic signature for classes
https://github.com/roave/signature
hacktoberfest
Last synced: about 1 year ago
JSON representation
:black_nib: Generate and verify basic signature for classes
- Host: GitHub
- URL: https://github.com/roave/signature
- Owner: Roave
- License: mit
- Created: 2016-11-04T14:05:22.000Z (over 9 years ago)
- Default Branch: 1.10.x
- Last Pushed: 2025-02-14T06:02:04.000Z (over 1 year ago)
- Last Synced: 2025-02-14T07:19:43.322Z (over 1 year ago)
- Topics: hacktoberfest
- Language: PHP
- Homepage:
- Size: 464 KB
- Stars: 43
- Watchers: 10
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# :black_nib: Roave\Signature
Sign and validate signed files made easy.
**Note: this is not a cryptographic signing library.**
## Installation
The suggested installation method is via [composer](https://getcomposer.org/):
```bash
$ composer require roave/signature
```
## Usage examples
### Signing a file
```php
// 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'));
```
### Validating a signed 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'));
```