berlioz / helpers
Many PHP functions used in the Berlioz framework, which you can use in your developments.
Installs: 34 491
Dependents: 13
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 4
Open Issues: 0
pkg:composer/berlioz/helpers
Requires
- php: ^7.3 || ^8.0
- ext-intl: *
- ext-mbstring: *
Requires (Dev)
- phpunit/phpunit: ^9.3
Suggests
- ext-gd: Allows to use image helpers functions
- ext-simplexml: Allows to use XML functions
Conflicts
README
Many PHP functions used in the Berlioz framework, which you can use in your developments.
Array
-
b_array_is_list(array $array): boolIs sequential array?
-
b_array_column(array $array, int|string|\Closure|null $column_key, int|string|\Closure|null $index_key = null): arrayGet values from a single column in the input array.
Difference between native array_column() and b_array_column() is that b_array_column() accept a \Closure in keys arguments.
-
b_array_merge_recursive(array $arraySrc, array ...$arrays): arrayMerge two or more arrays recursively.
Difference between native array_merge_recursive() is that b_array_merge_recursive() do not merge strings values into an array.
-
b_array_traverse_exists(&$mixed, string $path): boolTraverse array with path and return if path exists.
-
b_array_traverse_get(&$mixed, string $path, $default = null): mixed|nullTraverse array with path and get value.
-
b_array_traverse_set(&$mixed, string $path, $value): boolTraverse array with path and set value.
-
b_array_simple(array $array, ?string $prefix = null): arraySimplify a multidimensional array to simple.
File
-
b_human_file_size($size, int $precision = 2): stringGet a human see file size.
-
b_size_from_ini(string $size): intGet size in bytes from ini conf file.
-
b_resolve_absolute_path(string $srcPath, string $dstPath): ?stringResolve absolute path from another.
-
b_resolve_relative_path(string $srcPath, string $dstPath): stringResolve relative path from another.
-
b_fwritei(resource $resource, string $str, ?int $length = null, ?int $offset = null): int|falseFile write in insertion mode.
-
b_ftruncate(resource $resource, int $size, ?int $offset = null): boolTruncate a part of file and shift rest of data.
Object
-
b_get_property_value($object, string $property, &$exists = null): mixedGet property value with getter method.
-
b_set_property_value($object, string $property, $value): boolSet property value with setter method.
String
-
b_str_random(int $length = 12, int $options = B_STR_RANDOM_NUMBER | B_STR_RANDOM_SPECIAL_CHARACTERS | B_STR_RANDOM_NEED_ALL): stringGenerate an random string.
-
b_nl2p(string $str): stringSurrounds paragraphs with "P" HTML tag and inserts HTML line breaks before all newlines; in a string.
-
b_str_remove_accents(string $str): stringRemove accents.
-
b_str_to_uri(string $str): stringString to URI string.
-
b_minify_html(string $str): stringMinify HTML string.
-
b_str_truncate(string $str, int $nbCharacters = 128, int $where = B_TRUNCATE_RIGHT, string $separator = '...'): stringTruncate string.
-
b_parse_str(string $str, bool $keepDots = true): arrayParses the string into variables.
-
b_pascal_case(string $str): stringGet pascal case convention of string.
-
b_camel_case(string $str): stringGet camel case convention of string.
-
b_snake_case(string $str): stringGet snake case convention of string.
-
b_spinal_case(string $str): stringGet spinal case convention of string.