Skip to content

Commit d8fb54c

Browse files
Update Modifiers.md with multiple pipes documentation
- Added "Chaining Multiple Modifiers" section - Included examples showing multiple pipes usage - Explained escaped pipe behavior - Documented sequential left-to-right application Co-authored-by: henriquemoody <154023+henriquemoody@users.noreply.github.com>
1 parent a47564c commit d8fb54c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/modifiers/Modifiers.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,27 @@ Modifiers form a chain where each modifier can:
1515
1. **Handle the value** and return a transformed string
1616
2. **Pass the value** to the next modifier in the chain
1717

18+
### Chaining Multiple Modifiers
19+
20+
You can chain multiple modifiers together by separating them with the pipe (`|`) character. Modifiers are applied sequentially from left to right, with each modifier receiving the output of the previous one.
21+
22+
```php
23+
$formatter = new PlaceholderFormatter([
24+
'phone' => '1234567890',
25+
'value' => '123456',
26+
]);
27+
28+
// Apply pattern formatting, then mask sensitive data
29+
echo $formatter->format('Phone: {{phone|pattern:(###) ###-####|mask:6-12}}');
30+
// Output: Phone: (123) ******90
31+
32+
// Escaped pipe in pattern argument, then apply mask
33+
echo $formatter->format('{{value|pattern:###\|###|mask:1-3}}');
34+
// Output: ***|456
35+
```
36+
37+
**Important:** When using the pipe character (`|`) as part of a modifier argument (not as a separator), escape it with a backslash (`\|`).
38+
1839
## Basic Usage
1940

2041
```php

0 commit comments

Comments
 (0)