# Message
# Summary
Message enables to create strings with template tags support.
# Installing
Message is available through Packagist (opens new window) and the repository source is at chevere/message (opens new window).
composer require chevere/message
# Creating a Message
Use function message
to create a Message by passing the message template. Use named named arguments to define replacement pairs.
Supported tags:
%tag%
{{tag}}
{{ tag }}
use function Chevere\Message\message;
$message = message(
'Hello, %tag%!',
tag: 'World'
);
# To string
The __toString
method return the message with translated placeholders.
$message->__toString();
// Hello, World!
# Utility methods
# Template
Use template
method to return the message template.
$message->template();
// Hello, %tag%!
# Replacements
Use replacements
method to read message replacement pairs.
$message->replacements();
// ['tag' => 'World']