phico/support

Support classes and functions for Phico

dev-main 2024-09-19 16:29 UTC

This package is auto-updated.

Last update: 2024-10-19 16:40:16 UTC


README

Support classes and functions for Phico

Reference

str() Returns a new string instance

Convert json to string

// optionally pass boolean as_array as the second argument
$json = str()->toJson($object, $as_array=false);

Decode json from string

// optionally pass any flag constants as the second argument
$object = str()->fromJson($json, $flags = null);

Sanitise a string

$clean = str()->sanitise($input);
// older alias str()->sanitize($input);

split a string on capitals

$str = str()->splitOnCaps('ACapitalisedString);
// A Capitalised String

convert a string to camel case

$str = str()->toCamelCase('This is Camel case);
// thisIsCamelCase

convert a string to kebab case

$str = str()->toKebabCase('This is Kebab case);
// this-is-kebab-case

convert a string to pascal case

$str = str()->toPascalCase('This is pascal case);
// This Is Pascal Case

convert a string to train case

$str = str()->toTrainCase('This is train case);
// This-Is-Train-Case

Issues

If you discover any bugs or issues in behaviour or performance please create an issue, and if you are able a pull request with a fix.

Please make sure to update any tests as appropriate.

For major changes, please open an issue first to discuss what you would like to change.

License

BSD-3-Clause