I am trying to create a custom parser for shortcodes in PHP, but I need directions on which php function (or maybe even php library) to use. Note that I am using Laravel 5, so packages are welcome too.
For example, I have a string in this format:
Hello {{user.first_name}}, your ID is {{user.id}}
I have a $user
object containing these parameters. I'd like to check if all shortcode parameters within the string exist in the object, if not, I'd like to return an error, and if yes, I'd like to return the parsed string which would equal to:
Hello John, your ID is 123.
UPDATE
Please note that I'm building a REST API and this would be used in an automated email system. I need the result in a string within the controller so I can use it in my mailing function before the json response is returned.