Execute JSON defined user scripts

1.0.1 2022-03-30 19:53 UTC



Execute user scripts defined in a JSON

Allowed functions

  • md5: Generate a md5 key from its argument value
  • sha1: Generate a sha1 key from its argument value
  • time: Return time from the beginning of the unix epoch in seconds (1.1.1970)
  • date: Return date in a specified format
  • strtotime: Convert a date string to number of seconds from the beginning of the unix epoch
  • base64_encode
  • hash_hmac: See PHP documentation
  • sprintf: See PHP documentation
  • concat: Concatenate its arguments into a single string
  • ifempty: Return first argument if is not empty, otherwise return second argument
  • implode: Concatenate an array from the second argument, using glue string from the first arg


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": [
    • Example with a nested function (will return a date in the same format from 3 days ago):

          "function": "date",
          "args": [
                  "function": "strtotime",
                  "args": ["3 days ago"]
  • A key from the parameters array:
    • { "attr": "attributeName" } for $params['attr']['attributeName']
    • or { "param": "" } for $params['param']['nested']['attribute']['name']
    • The first level is always used as the key to determine the "type"


MIT licensed, see LICENSE file.