bfg/text

与文本工作的各种芯片

维护者

详细信息

github.com/bfg-s/text

源代码

问题

安装次数: 17,175

依赖项: 4

建议者: 0

安全: 0

星标: 1

关注者: 2

分支: 1

开放问题: 0

类型:bfg-app

0.0.4 2023-05-22 14:55 UTC

This package is auto-updated.

Last update: 2024-09-22 18:05:00 UTC


README

辅助工具

is_json

检查行是否为Json对象。

is_json(json_encode(['test' => true])); 
// true

lang_in_text

应用语言变量的特殊触发器。

lang_in_text("Text: @validation.accepted"); 
// Text: The :attribute must be accepted.

tag_replace

在对象值或数组上进行标签替换。

tag_replace("Hello, {user.name} {user.lastname}. You phone: {phone}", [
    'user' => ['name' => 'Ivan', 'lastname' => 'Petrov'],
    'phone' => '123456789'
]); 
// Hello, Ivan Petrov. You phone: 123456789

file_lines_get_contents

通过行获取文件数据。

file_lines_get_contents('LICENSE.md', 3, 3); 
//Copyright (c) 2021 BFG <bfg.script@gmail.com>