php-etl / string-expression-language
This library implements functions for manipulating string data in ExpressionLanguage
Installs: 3 241
Dependents: 0
Suggesters: 1
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 1
Requires
- php: ^8.2
- symfony/expression-language: ^6.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.0
- rector/rector: ^0.15
This package is auto-updated.
Last update: 2024-11-12 13:50:19 UTC
README
This package extends the ExpressionLanguage component of Symfony to compile and evaluate arrays with custom functions.
Installation
composer require php-etl/string-expression-language
Usage
You can use these expressions in your configuration files as in the following example :
foo: '@=format("%s", "output")'
List of available functions
Generic functions
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