Download the PHP package wanze/template-engine-factory without Composer

On this page you can find all versions of the php package wanze/template-engine-factory. 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 template-engine-factory

Template Engine Factory

StyleCI License: MIT ProcessWire 3

A ProcessWire module integrating template engines such as Twig. It allows to render pages or individual templates via template engine and encourages to separate logic from markup by implementing a simple MVC pattern.

Version 2.x of this module differs from the 1.x version in many ways. Modules providing template engines must be installed with Composer. Please take a look at the update guide, as the new version introduces backwards compatibility breaks. The 1.x version of the module is available on the 1.x branch.

Requirements

Installation

Execute the following command in the root directory of your ProcessWire installation:

This installs the module and its bundled template engine called TemplateEngineProcessWire. This template engine uses ProcessWire's internal TemplateFile class for rendering. Other template engines are added to the factory by installing separate ProcessWire modules.

Installing Twig and other template engines

Each template engine is a separate ProcessWire module. For example, if you want to use Twig, execute the following command:

This will install the TemplateEngineTwig module and all Twig dependencies.

ℹī¸ This module includes test dependencies. If you are installing it on production with composer install, make sure to pass the --no-dev flag to omit autoloading any unnecessary test dependencies!.

Configuration

The TemplateEngineFactory offers the following configuration options:

More configuration options might be available in the module providing a template engine, e.g. the module TemplateEngineTwig offers several configuration related to Twig.

Available template engines

Getting Started

This section assumes that Twig is used as active template engine, but the usage is exactly the same for any other chosen template engine.

Using the template engine to render templates

Assume the following Twig template exists in /site/templates/views/foo.html.twig

The template can be rendered anywhere with the Template Engine Factory module:

Automatic Page Rendering

If enabled, this feature uses the template engine to render ProcessWire pages when calling Page::render. By default, the module tries to find a Twig template matching the same name as the ProcessWire template:

ProcessWire templates have access to a $view API variable which can be used to pass data to the template engine. As the template engine is now responsible to output markup, ProcessWire templates can be seen as Controllers. They process the request and pass data to the View layer via the $view API variable.

Examples

Consider the following ProcessWire template in /site/templates/home.php

The corresponding Twig template in /site/templates/views/home.html.twig might look like this:

Note that the ProcessWire template does not echo out any markup. It just contains business logic and uses the $view API variable to pass data to the Twig template. That's it! The most simple MVC pattern available in ProcessWire. 😎


All versions of template-engine-factory with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
composer/installers Version ~1.0
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 wanze/template-engine-factory contains the following files

Loading the files please wait ....