Download the PHP package dhii/delimited-token-template without Composer

On this page you can find all versions of the php package dhii/delimited-token-template. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package delimited-token-template

Delimited Token Template

A flexible implementation for handlebars-style templates.

Continuous Integration

Details

This template implementation is useful if you need to replace simple tokens with values. Good examples are emails, which contain text like "Hello, %username%", or paths with variable segments, such as "/users/:username/profile".

The template supports any string delimiters: '[*placeholder*]', '~placeholder', and "{{placeholder}}" will all work. It's possible to have the left delimiter different from the right one, have delimiters which contain more than one character, or to even omit one of the delimiters.

When two delimiters are used, they can be escaped by a configurable escape character to make them be used literally in the rendered result. With the left and right delimiters being "{{" and "}}" respectively, and the escape char being "\", the string "{{ {{username}}" could produce "{{ johnny" if rendered with context ['username' => 'johnny']. If the second left delimiter was escaped instead, i.e. "Hello, {{ {{username}}", rendering with [' {{username' => 'johnny'] would produce "Hello, johnny". This demonstrates that escaped delimiters will be replaced with their literal value in both the end result, and in token names.

Using one delimiter is also possible, e.g. "Hello, :username!" would produce "Hello, johnny!" when rendered with context ['username' => 'johnny']. In this case, however, contrary to using two delimiters, token names are limited to alphanumeric chars, as well as '_', '-', and '.' (underscore, dash, and period). In addition, it is not possible to escape delimiters. Consequently, token names cannot contain delimiters.

Usage

Two delimiters

This example uses two identical delimiters, and an escaped delimiter in the middle of the token name.

Different long delimiters

This example uses two different delimiters that are longer than 1 character, and of different lengths.

One delimiter with factory

Often times there will be some kind of convention within your application with regard to delimiters and the escape character. This these cases, it often useful to be able to instantiate several templates based on that standard, without having to specify it every time. The factory can represent that convention. This example uses tokens with only the left delimiter.


All versions of delimited-token-template with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1 | ^8.0
dhii/output-renderer-interface Version ^0.4-alpha1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dhii/delimited-token-template contains the following files

Loading the files please wait ....