rafaeldsb/php-string-tags
Composer 安装命令:
composer require rafaeldsb/php-string-tags
包简介
helpers who assist in string tags.
README 文档
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
统计信息
- 总下载量: 47
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-02-09