Download the PHP package echo-fusion/templatemanager without Composer

On this page you can find all versions of the php package echo-fusion/templatemanager. 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 templatemanager

TemplateManager

CI Packagist PHP

TemplateManager renders templates for the EchoFusion framework. It has no dependency on Symfony or Laravel: it ships its own small template language (in the spirit of Twig/Smarty), supports plain PHP templates, and lets you plug in other engines such as Twig through configuration.

It implements EchoFusion\Contracts\TemplateManager\TemplateManagerInterface from echo-fusion/contracts, so other packages can depend on the interface only.

Part of EchoFusion, a modular PHP framework built from small packages.

Installation

Requirements

Quick start

With no engines setting the built-in tpl engine and plain php engine are enabled. render() returns a string; wrap it yourself in a response, e.g. new HtmlResponse($templates->render('home')) from echo-fusion/responsemanager.

The built-in template language (.tpl)

Layouts: extends and block

Inheritance can be nested. In a child template only {% block %} and {% set %} may appear outside blocks.

Custom filters

Compilation and cache

Templates are compiled to PHP files. Options for the tpl engine:

Option Default
cache <system temp>/echofusion-templates cache directory
auto_reload true recompile when the template changes; set false in production for the fastest start
autoescape true HTML-escape {{ }}

Expressions are translated token by token, so a template cannot inject PHP code.

Plain PHP templates (.php)

In a layout, <?= $this->section('content') ?> is the child output and $this->section('sidebar', 'default') any named section. $this->e() escapes. Section output is already rendered, so it is not escaped again.

Namespaces (modules)

Give a directory a namespace and address its templates as @namespace/name:

This pairs with echo-fusion/modulemanager:

Directories are searched in the order they were added, so add an application directory first to override a module template.

Configuration

An engine entry is the file extension. tpl, php and twig are built in; for any other extension give a class. Names can carry the extension (render('home.twig')) to pick an engine explicitly. Pass the same array to TemplateManager::fromConfig(), or to $manager->configure() on an existing manager.

Your own engine

Implement EchoFusion\Contracts\TemplateManager\TemplateEngineInterface (render(), exists()). The manager creates it as new YourEngine(TemplateFinder $finder, string $extension, array $options); use $finder->find($name, $extension) to locate files and namespaces.

Twig

TwigEngine hands the manager's directories and namespaces to Twig, so @blog/post works the same way. options go to Twig\Environment. Twig is optional: without twig/twig installed, only configuring a twig engine fails.

Service provider

EchoFusion\TemplateManager\Providers\TemplateManagerProvider registers TemplateManagerInterface and TemplateEngineInterface in a container and, on boot(), configures the manager from the templates section of your config.

Errors

All exceptions extend EchoFusion\TemplateManager\Exceptions\TemplateException: TemplateNotFoundException, TemplateSyntaxException (with template name and line), InvalidConfigException.

Template names are validated: .., absolute paths, backslashes and NUL bytes are never resolved, so a user-controlled name cannot read files outside the template directories.

Testing

Credits

License

The MIT License (MIT). Please see LICENSE for more information.


All versions of templatemanager with dependencies

PHP Build Version
Package Version
Requires php Version ~8.1.0 || ~8.2.0 || ~8.3.0
echo-fusion/contracts Version ^1.6 || ^2.0
ext-mbstring Version *
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 echo-fusion/templatemanager contains the following files

Loading the files please wait ...