This package extends the ExpressionLanguage component of Symfony to compile and evaluate arrays with custom functions.
composer require php-etl/string-expression-language
You can use these expressions in your configuration files as in the following example :
foo: '@=format("%s", "output")'
format(string $format, mixed ...$values) : string
=> Return a formatted stringtrim(string $string, string $characters = " \n\r\t\v\x00") : string
=> Strip whitespace (or other characters) from the beginning and end of a stringcapitalize(string $string) : string
=> Make a string's first character uppercasetoLowerCase(string $string) : string
=> Make a string lowercasesearch(string $string, int $offset, ?int $length = null) : string
=> Return part of a stringtoUpperCase(string $string) : string
=> Make a string uppercasefileName(string $string) : string
=> Returns information about a file pathdateTime(string $string) : string
=> Returns new DateTimeImmutable object formatted according to the specified formatformatDate(string $string) : string
=> Returns date formatted according to given formatindexOf(string $haystack, string $needle, int $offset) : int|false
=> Find the position of the first occurrence of a substring in a stringtruncate(string $string, int $limit) : string
=> Truncates the string and adds "…" at the end, if the string is longer than the limit