bfg / text
与文本工作的各种芯片
0.0.4
2023-05-22 14:55 UTC
Requires
- php: >=8.0.0
- bfg/object: ^0.0.4
Requires (Dev)
- mockery/mockery: ^1.3.1
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.0
- squizlabs/php_codesniffer: ^3.5
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>