[Feature request] Random expression parser
Closed this issue · 1 comments
Let's say I have a user provided string which contains some placeholder expressions which the library has to parse and generate random expressions based on user input.
Let's say the user provides this input:
Lorem __rand_range(1, 4) dolor sit amet, __rand_int(10) adipiscing elit. Ut nisi libero, luctus id iaculis vel, __rand_str(20) non eros. Morbi porttitor velit id leo __rand_date() vestibulum. Quisque egestas __rand_chr(3) nibh. Proin maximus eros ut magna pellentesque __rand_float(). Vivamus rhoncus nulla id tellus __rand_byte(3) pharetra. Cras scelerisque libero a maximus egestas. Duis at sapien sed augue gravida pellentesque. Cras interdum volutpat porttitor. Vivamus a auctor erat.
The parser should be able to read the input and swap the placeholder expressions with the appropriate random value then return the parsed string.
To use it:
Randomize::expression()->parse($input_string)->generate();
This is a good suggestion, but i think that is out of scope for this small library. I think that you could aschieve thast using this library with a kind of templating system (blade or twig) and/or using a more powerful data generator like Faker.
So i'm going to close this issue, but i really appreciate this kind of "feedback" or feature request.
Thank you!!!!