Skip to content

Commit

Permalink
Document Svg::sanitize()
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeTowers authored Dec 28, 2023
1 parent 0382634 commit 34aa68a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions services/helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,22 @@ By default, the output SVG markup is minified. The second parameter allows you t
$unminifiedSvg = Svg::extract('/path/to/image.svg', false);
```

### `Svg::sanitize()`

The `sanitize` method allows you to sanitize the provided SVG markup. Sanitization prevents the use of
JavaScript, remote sources and CSS imports, stopping common attack vectors within SVG code.

```php
$svg = Svg::sanitize($untrustedSvgContent);
```

By default, the output SVG markup is minified. The second parameter allows you to disable this by setting it to `false`.

```php
$unminifiedSvg = Svg::sanitize($untrustedSvgContent, false);
```


## Miscellaneous

### `asset()`
Expand Down

0 comments on commit 34aa68a

Please sign in to comment.