Skip to content

Commit ba44826

Browse files
committed
Update README.md
1 parent a81cf84 commit ba44826

1 file changed

Lines changed: 20 additions & 10 deletions

File tree

README.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ You also need a X.509 certificates related to your stored keys. To create a self
1313
or to create a CSR for the certificate authority of your choice, you can use a tool we prepared
1414
[here](https://github.com/Setasign/Cloud-KMS-CSR).
1515

16-
The package is developed and tested on PHP >= 5.6. Requirements of the [SetaPDF-Signer](https://www.setasign.com/signer)
17-
component can be found [here](https://manuals.setasign.com/setapdf-signer-manual/getting-started/#index-1).
16+
The current version of the package is developed and tested on PHP >= 8.1 up to PHP 8.5. Requirements of the
17+
[SetaPDF-Signer](https://www.setasign.com/signer) component can be found
18+
[here](https://manuals.setasign.com/setapdf-signer-manual/getting-started/#index-1).
1819

1920
## Installation
2021
Add following to your composer.json:
@@ -39,11 +40,14 @@ and execute `composer update`. You need to define the `repository` to evaluate t
3940

4041
The Setasign repository requires authentication data: You can use your credentials
4142
of your account at [setasign.com](https://www.setasign.com) to which your licenses
42-
are assigned. You will be asked for this during a composer run. See
43-
[here](https://getcomposer.org/doc/articles/authentication-for-private-packages.md#http-basic)
43+
are assigned or use an access token which you can create in your personal
44+
[composer settings](https://www.setasign.com/my-setasign/composer-settings/#bearer-authentication)
45+
on setasign.com.
46+
See [here](https://getcomposer.org/doc/articles/authentication-for-private-packages.md#http-basic)
4447
for more options for authentication with composer.
4548

46-
**You have to define your credentials for AWS KMS in [environment variables](https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/guide_credentials_environment.html).**
49+
**You have to define your credentials for AWS KMS as documented
50+
[here](https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/guide_credentials_default_chain.html).**
4751

4852
## Usage
4953

@@ -57,11 +61,17 @@ component.
5761
A simple complete signature process would look like this:
5862

5963
```php
60-
$kmsClient = new Aws\Kms\KmsClient\KmsClient([
64+
use Aws\Kms\KmsClient;
65+
use setasign\SetaPDF\Signer\Module\AwsKMS\Module;
66+
use setasign\SetaPDF2\Core\Document;
67+
use setasign\SetaPDF2\Core\Writer\FileWriter;
68+
use setasign\SetaPDF2\Signer\Signer;
69+
70+
$kmsClient = new KmsClient([
6171
'region' => $region,
6272
'version' => $version,
6373
]);
64-
$awsKmsModule = new setasign\SetaPDF\Signer\Module\AwsKms\Module($keyId, $kmsClient);
74+
$awsKmsModule = new Module($keyId, $kmsClient);
6575

6676
$cert = file_get_contents('your-cert.crt');
6777
$awsKmsModule->setCertificate($cert);
@@ -71,12 +81,12 @@ $awsKmsModule->setSignatureAlgorithm($algorithm);
7181
$fileToSign = __DIR__ . '/Laboratory-Report.pdf';
7282

7383
// create a writer instance
74-
$writer = new SetaPDF_Core_Writer_File('signed.pdf');
84+
$writer = new FileWriter('signed.pdf');
7585
// create the document instance
76-
$document = SetaPDF_Core_Document::loadByFilename($fileToSign, $writer);
86+
$document = Document::loadByFilename($fileToSign, $writer);
7787

7888
// create the signer instance
79-
$signer = new SetaPDF_Signer($document);
89+
$signer = new Signer($document);
8090
$signer->sign($awsKmsModule);
8191
```
8292

0 commit comments

Comments
 (0)