keboola / codebuilder
Execute JSON defined user scripts
Installs: 4 766
Dependents: 3
Suggesters: 0
Security: 0
Stars: 1
Watchers: 20
Forks: 0
Open Issues: 2
Requires
- php: >=7.4
- ext-json: *
- keboola/php-utils: ^4.1
Requires (Dev)
- keboola/coding-standard: >=9.0
- php-parallel-lint/php-parallel-lint: ^1.2
- phpstan/phpstan: ^0.12
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-11-20 11:00:14 UTC
README
Description
Execute user scripts defined in a JSON
Allowed functions
md5
: Generate a md5 key from its argument valuesha1
: Generate a sha1 key from its argument valuetime
: Return time from the beginning of the unix epoch in seconds (1.1.1970)date
: Return date in a specified formatstrtotime
: Convert a date string to number of seconds from the beginning of the unix epochbase64_encode
hash_hmac
: See PHP documentationsprintf
: See PHP documentationconcat
: Concatenate its arguments into a single stringifempty
: Return first argument if is not empty, otherwise return second argumentimplode
: Concatenate an array from the second argument, using glue string from the first arghash
: See PHP documentation
Syntax
The function must be specified in a JSON format, which may contain one of the following 4 objects:
- String:
{ "something" }
- Function: One of the allowed functions above
-
Example (this will return current date in this format:
2014-12-08+09:38
:{ "function": "date", "args": [ "Y-m-d+H:i" ] }
-
Example with a nested function (will return a date in the same format from 3 days ago):
{ "function": "date", "args": [ "Y-m-d+H:i", { "function": "strtotime", "args": ["3 days ago"] } ] }
-
- A key from the parameters array:
{ "attr": "attributeName" }
for $params['attr']['attributeName']- or
{ "param": "nested.attribute.name" }
for $params['param']['nested']['attribute']['name'] - The first level is always used as the key to determine the "type"
License
MIT licensed, see LICENSE file.