Create a Macro

Example

Create a new file /application/macros/randomx.php

Insert the code:

<?php
namespace Macros;
 
use Component\Streams\Model\BaseStream;
use Component\Clicks\Model\RawClick;
use Component\Macros\AbstractClickMacro;
 
class randomx extends AbstractClickMacro
{
    public function process(BaseStream $stream, RawClick $rawClick, $min, $max)
    {
        return rand($min, $max);
    }
}

The class name must be the same as file name.

You can pass parameters from the macro:

{random:100,999}

$min = 100, $max = 999.

Read about objects $stream and $rawClick on page Internals.