Skip to content

[Discussion] TemplateTextEncoder #61

@vatson

Description

@vatson

I came up with to add a simple template encoder. It will take the normalized data as array and use the array keys to insert the values ​​in the template.

Usecase

<?php

$encoder = new TemplateTextEncoder();
$encoder->setDelimiter('%');
$encoder->setTemplate("Subject: %subject%" . PHP_EOL . "Message: %message%");

$encoder->encode(array('subject' => 'Server crashed', 'message' => 'Something unexpected happened'), 'template-text');

@makasim what do you think about the idea?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions