Skip to content

[Feature]: Add stripTags method for stripping HTML/PHP tags #27

@viniciusvts

Description

@viniciusvts

Feature Description

Create a stripTags method to remove all HTML and PHP tags from a string. Support specifying allowed tags (as in PHP's strip_tags).

Use Case

Sanitizing user input for display, emails, logs, or before further string transformations—avoiding XSS and rendering issues.

Static Usage

$clean = SM::stripTags('<p>Paragraph</p><b>Bold</b>');
// Output: 'ParagraphBold'

Fluent Usage

$clean = SM::make('<p>Welcome</p><a href="#">here</a>')->stripTags('<a>');
// Output: 'Welcomehere'

Checklist

  • I have read the documentation
  • I have read the existing Methods documentation
  • I have searched for similar feature requests

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions