src/LaravelHelpersServiceProvider.php
public function replaceVariables($string, $replaces = [])
    {
        $callback = function ($match) use ($replaces) {
            $variable = trim($match[0], '{}');

            if(array_key_exists($variable, $replaces))
            {
                return $replaces[$variable];
            }

            return $variable;
        };

        return preg_replace_callback('/{.*?}/', $callback, $string);
    }
public function replaceVariables($string, $replaces = [])
    {
        $callback = function ($match) use ($replaces) {
            $variable = trim($match[0], '{}');

            if(array_key_exists($variable, $replaces))
            {
                return $replaces[$variable];
            }

            return $variable;
        };

        return preg_replace_callback('/{.*?}/', $callback, $string);
    }
Replace variables in string with their values.

@param $string
@param array $replaces
@return string