Skip to content

Commit

Permalink
Merge pull request #15 from IlicMiljan/document-placeholder-value
Browse files Browse the repository at this point in the history
Placeholder Value - Update `README.md`
  • Loading branch information
IlicMiljan authored Mar 15, 2024
2 parents bd1e665 + ff48b1b commit 5fb64b5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,22 @@ Ensure that your `composer.json` file is updated and the library is included in

### Marking Properties for Encryption

Use the `#[Encrypted]` attribute to mark properties within your classes that you wish to encrypt or decrypt. For example:
Use the `#[Encrypted]` attribute to mark properties for encryption. This attribute supports an optional `placeholder`
parameter for customizable decryption failure handling.

When decryption fails, and a `placeholder` is provided, that value is used instead. If the placeholder is null,
an exception may be thrown.

```php
use IlicMiljan\SecureProps\Attribute\Encrypted;

class User
{
#[Encrypted]
#[Encrypted(placeholder: "***-**-****")]
private string $socialSecurityNumber;

// Other properties and methods...
#[Encrypted]
private string $secretNote;
}
```

Expand Down

0 comments on commit 5fb64b5

Please sign in to comment.