rafaeldsb / php-string-tags
helpers who assist in string tags.
Installs: 47
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 1
pkg:composer/rafaeldsb/php-string-tags
Requires
- php: >=7.3
Requires (Dev)
- codacy/coverage: dev-master
- phpunit/php-code-coverage: ^8.0
- phpunit/phpunit: ^9
This package is auto-updated.
Last update: 2025-10-06 20:19:49 UTC
README
This package is a helper for tags in strings
Installation
composer require rafaeldsb/php-string-tags
Basic Usage
<?php use RafaelDsb\Helpers\Tag; $string = 'A string with a {{key}} and a {{tag}}'; $keys = Tag::getTags($string); // It returns ['key', 'tag'] $newString = Tag::replaceTags($string, ['key' => 'little key', 'tag' => 'door']); echo $newString; // A string with a little key and a door
Advanced Usage
You can use it with other characters to process the tags
<?php use RafaelDsb\Helpers\Tag; $string = 'A string with a <key> and a <tag>'; $keys = Tag::getTags($string, '<', '>'); // It returns ['key', 'tag'] $newString = Tag::replaceTags($string, ['key' => 'little key', 'tag' => 'door'], '<', '>'); echo $newString; // A string with a little key and a door