phico / support
为 Phico 提供支持类和函数
dev-main
2024-09-19 16:29 UTC
Requires
- php: ^8.0
Requires (Dev)
- pestphp/pest: ^2.34
- phpstan/phpstan: ^1.11
This package is auto-updated.
Last update: 2024-09-19 16:29:36 UTC
README
为 Phico 提供支持类和函数
参考
str() 返回一个新的字符串实例
将 json 转换为字符串
// optionally pass boolean as_array as the second argument $json = str()->toJson($object, $as_array=false);
将字符串解码为 json
// optionally pass any flag constants as the second argument $object = str()->fromJson($json, $flags = null);
净化字符串
$clean = str()->sanitise($input); // older alias str()->sanitize($input);
在首字母大写处分割字符串
$str = str()->splitOnCaps('ACapitalisedString); // A Capitalised String
将字符串转换为驼峰式
$str = str()->toCamelCase('This is Camel case); // thisIsCamelCase
将字符串转换为中划线式
$str = str()->toKebabCase('This is Kebab case); // this-is-kebab-case
将字符串转换为帕斯卡式
$str = str()->toPascalCase('This is pascal case); // This Is Pascal Case
将字符串转换为 train case
$str = str()->toTrainCase('This is train case); // This-Is-Train-Case
问题
如果您发现任何关于行为或性能的bug或问题,请创建一个问题,如果您能够提供修复的 pull request 则更好。
请确保根据需要更新任何测试。
对于重大更改,请首先打开一个问题来讨论您想要更改的内容。