Chevere Message 1.0

Strings with template tags support

rodber   GitHub

New from Chevere is the Message package. This software enables to create strings with template tags support.

The package source is available at chevere/message.

This package is basic and straightforward. It provides the message function which you use by passing the message template and replacement tags.

use function Chevere\Message\message;

$template = "I'm the {{what}}, {{what}}, {{name}}";
    what: 'miggida',
    name: 'Mac Daddy',
// I'm the miggida, miggida, Mac Daddy

By passing the template you can generate different messages:

    what: 'chicka',
    name: 'McLovin',
// I'm the chicka, chicka, McLovin

And that's it. Simple and easy.

I use this package a lot in my projects as it's very useful to generate messages with dynamic content. My main use case is for creating error messages, but it can be used for anything.

Rodolfo blogging since 2012.