$parser = new \PhpTemplateParse\Parser\HtmlParser(); $template = "Hello {{name}}
"; $variables = ["name" => "World"]; $output = $parser->parse($template, $variables); echo $output;
$parser = new \PhpTemplateParse\Parser\CsvParser(); $template = "Name,Email\n{{name}},{{email}}"; $variables = ["name" => "John", "email" => "john@example.com"]; $output = $parser->parse($template, $variables); echo $output;This example demonstrates using the CsvParser to parse a CSV template and replace the variables with the given values. The parser returns the final CSV output that can be stored in a file or sent as an email attachment. Package Library: The PhpTemplateParse library is available on Packagist as a Composer package. The library has a single namespace `PhpTemplateParse` that contains all the classes and interfaces. The library includes several parser classes for different template formats, such as HTML, CSV, XML, and plain text. The library also includes abstract classes and interfaces for implementing custom parsers or extensions.